| Code: : |
<?php if (eregi("block-AAO_Stats.php", $_SERVER['PHP_SELF'])) { Header("Location: index.php"); die(); } global $user, $cookie, $prefix, $db, $user_prefix, $stack; // Replace with your Clan Tracker ID $clanid="46300"; // Parse XML $stack = array(); $claninfo = array(); $clanstats = array(); $playerstats = array(); $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startTag", "endTag"); xml_set_character_data_handler($xml_parser, "cdata"); $xmllink="http://aaotracker.4players.de/livefeed/xml_clanprofile.php?clanid=$clanid"; $data = xml_parse($xml_parser,file_get_contents($xmllink)); if(!$data) die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); xml_parser_free($xml_parser); // Get Data // Get Clan Profile Data for($i = 0; $i < sizeof($stack[0][children][0][children]); $i++) { $valname=$stack[0][children][0][children][$i][name]; $claninfo[$valname]=$stack[0][children][0][children][$i][cdata]; } // Get Clan Stats Data for($i = 0; $i < sizeof($stack[0][children][1][children]); $i++) { $valname=$stack[0][children][1][children][$i][name]; $clanstats[$valname]=$stack[0][children][1][children][$i][cdata]; } // Get Player Data for($i = 0; $i < sizeof($stack[0][children][2][children]); $i++) { for($x = 0; $x < sizeof($stack[0][children][2][children][$i][children]); $x++) { $valname=$stack[0][children][2][children][$i][children][$x][name]; $value=$stack[0][children][2][children][$i][children][$x][cdata]; if($valname=="PLAYERID") $pid=$value; $playerstats[$pid][$valname]=$value; } } // Now we have 3 arrays with all stats and infos. Prints all data the XML receives. // print_r($claninfo); //print_r($clanstats); // print_r($playerstats); //// CODE ADDED BY TRU (www.orcclan.us) or Contact VIA MSN at KenDog123@hotmail.com //// Starts the table without interfering in the duplication process ////with the Parsed XML Data. $content .= "<table align=\"center\" width=\"97%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\"> <tr><td></td></tr>"; //// CODE ADDITION ENDED foreach($playerstats as $key => $value) { $playername=$playerstats[$key][PLAYERNAME]; ///$playerhonor=$playerstats[$key][PLAYERHONOR]; $playerurl=$playerstats[$key][PLAYERSTATSURL]; // CODE ADDED BY TRU (www.orcclan.us) or Contact VIA MSN at KenDog123@hotmail.com ///$playerkills=$playerstats[$key][PLAYERKILLS]; ///$playerkia=$playerstats[$key][PLAYERDEATHS]; $playerroe=$playerstats[$key][PLAYERROE]; // Player's Fragrate is determined by PLAYERKILLS divided by PLAYERDEATHS. if($playerstats[$key][PLAYERSTATUS]=="1") $statuspic="ponline.gif"; else $statuspic="poffline.gif"; //if (round(($playerkills/$playerkia),2) < 1) { //$font = "#FF0000"; } //elseif (round(($playerkills/$playerkia),2) > 2) { //$font = "#009900"; //} //else { //$font = "#FFCC00"; //} // $frpercent = (round(($playerkills/$playerkia),2) * 100) - 100; // Displays the Parsed XML Data. You can edit if you know what you are doing. $content .= "<tr><td><font color=\"#FFFFCC\"><a target=\"_blank\" href=\"$playerurl\">$playername</a></font></td><td><img border=\"0\" src=\"./images/$statuspic\" </td></tr>"; } // Closes the table. $content .= "</table>"; // CODE ADDITION ENDED ?> |