<?php
$xmlSource=472;
unset($text);
$currentElement="";
$shows=array();
function startElement($parser,$name,$attr){
$GLOBALS['currentElement']=$name;
if(strcmp($name,"CLANSTATSURL")==0){
@$GLOBALS['CLANSTATSURL']=$attr["CLANSTATSURL"];
}
if(strcmp($name,"PLAYERSTATSSURL")==0){
$GLOBALS['PLAYERSTATSSURL']=$attr["PLAYERSTATSSURL"];
}
}
function endElement($parser,$name){
$elements=array('CLANID','CLANNAME','CLANTAG','CLANCOUNTRY','CLANSTATSURL',
'SCORE','MATCHES','WINS','LOSS','OSAA','KILLS','KILLASS','DEATHS','KDRATIO'
,'PLAYERID','PLAYERNAME','PLAYERCOUNTRY','PLAYERSTATUS','PLAYERSTATSURL','P
LAYERRANK','PLAYERTIME','PLAYERGLOBALSCORE','PLAYERMATCHES','PLAYERWINS','P
LAYERLOSS');
if(strcmp($name,"PLAYER")==0){
foreach($elements as $element){
$temp[$element]=$GLOBALS[$element];
}
$GLOBALS['shows'][]=$temp;
$GLOBALS['PLAYERID']="";
$GLOBALS['PLAYERNAME']="";
$GLOBALS['PLAYERCOUNTRY']="";
$GLOBALS['PLAYERSTATUS']="";
$GLOBALS['PLAYERSTATSURL']="";
$GLOBALS['PLAYERRANK']="";
$GLOBALS['PLAYERTIME']="";
$GLOBALS['PLAYERGLOBALSCORE']="";
$GLOBALS['PLAYERMATCHES']="";
$GLOBALS['PLAYERWINS']="";
$GLOBALS['PLAYERLOSS']="";
$GLOBALS['SCORE']="";
$GLOBALS['MATCHES']="";
$GLOBALS['WINS']="";
$GLOBALS['LOSS']="";
$GLOBALS['OSAA']="";
$GLOBALS['KILLS']="";
$GLOBALS['KILLASS']="";
$GLOBALS['DEATHS']="";
$GLOBALS['KDRATIO']="";
$GLOBALS['CLANID']="";
$GLOBALS['CLANNAME']="";
$GLOBALS['CLANTAG']="";
$GLOBALS['CLANCOUNTRY']="";
$GLOBALS['CLANSTATSURL']="";
}
}
function characterData($parser, $data) {
$elements = array ('CLANID','CLANNAME','CLANTAG','CLANCOUNTRY','CLANSTATSURL','SCORE','MATCHE
S','WINS','LOSS','OSAA','KILLS','KILLASS','DEATHS','KDRATIO','PLAYERID','PL
AYERNAME','PLAYERCOUNTRY','PLAYERSTATUS','PLAYERSTATSURL','PLAYERRANK','PLA
YERTIME','PLAYERGLOBALSCORE','PLAYERMATCHES','PLAYERWINS','PLAYERLOSS');
foreach ($elements as $element) {
if ($GLOBALS["currentElement"] == $element) {
@$GLOBALS[$element] .= $data;
}
}
}
function parseFile($xmlSource){
global $shows;
$xml_parser=xml_parser_create();
xml_set_element_handler($xml_parser,"startElement","endElement");
xml_set_character_data_handler($xml_parser,"characterData");
xml_parser_set_option($xml_parser,XML_OPTION_CASE_FOLDING,false);
if(!($fp=fopen("http://bf2142tracker.com/livefeed/xml_clanprofile.php?clanid=$xmlSource","r"))){
die("Cannot open $xmlSource ");
}
while(($data=fread($fp,4096))){
if(!xml_parse($xml_parser,$data,feof($fp))){
die(sprintf("XML error at line %d column %d ",
xml_get_current_line_number($xml_parser),
xml_get_current_column_number($xml_parser)));
}
}
xml_parser_free($xml_parser);
return $shows;
}
$result=parseFile($xmlSource);
foreach($result as $key){
@$text .="<div style='text-align:center'><b>".$key["CLANTAG"]."Clan</b></div>";
$text .="<div style='text-align:center'><a href=\" ".$key["CLANSTATSURL"]." \">View Profile</a></div><br/>";
break;
}
foreach($result as $key){
$text .="<Marquee Behavior='Scroll' Direction='left' Height='10' Width='100%' ScrollAmount='2' ScrollDelay='0' onMouseOver='this.stop()' onMouseOut='this.start()'>";
$text .="<div style='text-align:center'>
<b>Score:</b> ".$key["SCORE"]."
<b>Wins:</b> ".$key["WINS"]."
<b>Loss:</b> ".$key["LOSS"]."
<b>Kills:</b> ".$key["KILLS"]."
<b>Kill Assist:</b> ".$key["KILLASS"]."
<b>Deaths:</b> ".$key["DEATHS"]."
<b>K/D Ratio:</b> ".$key["KDRATIO"]."<br /></div>";
$text .="</marquee>";
break;
}
$text .="<Marquee Behavior='Scroll' Direction='Up' Height='200' Width='100%' ScrollAmount='2' ScrollDelay='1' onMouseOver='this.stop()' onMouseOut='this.start()'>";
foreach($result as $key){
$pstat=$key["PLAYERSTATUS"];
if(@strcmp($pid,$key["PLAYERID"])!=0){
if ($pstat ==1) {$statuspic="ponline.gif";}
else {$statuspic="poffline.gif";}
$prank=$key["PLAYERRANK"];
if($key["PLAYERCOUNTRY"]!="-") $playerCO=$key["PLAYERCOUNTRY"];
else $playerCO="unknown";
$text .="<br /><div style='text-align:left'>
<a href=' ".$key["PLAYERSTATSURL"]." '>".$key["PLAYERNAME"]." GS: ".$key["PLAYERGLOBALSCORE"]."</a>
</div>";
$text .="<div style='text-align:left'>
<img border='0' src='images/ranksmall_$prank.gif' width='16' height='16'>
<img border='0' src='images/CountryIcons/$playerCO.gif' width='18' height='12'>
<img src='images/$statuspic' border='0' width='42' height='16'>
</div>";
}
}
$text .="</marquee>";
echo $text;
?>
<?php
require("http://www.ausclan.com/tracker1/tracker1.php");
?>
<?php
// Change this data to fit your clan name and tracker ID
// PHP parsing script for Non-Nukers by -=[VGO]=-=Jinx=
// Thanks to: {A TEAM} Hannibal, =P=_MrYukk and obviously
// Mr_Papa who's code was most influential
$clanname="x(LMS)x Last Man Standing";
$clanid="22054";
// Code start
function startTag($parser, $name, $attrs) {
global $stack;
$tag=array("name"=>$name,"attrs"=>$attrs);
array_push($stack,$tag);}
function cdata($parser, $cdata) {
global $stack;
$stack[count($stack)-1]['cdata'] .= $cdata;
}
function endTag($parser, $name) {
global $stack;
$stack[count($stack)-2]['children'][] = $stack[count($stack)-1];
array_pop($stack);
}
function aSortBySecondIndex($multiArray, $secondIndex, $dir) {
while (list($firstIndex, ) = each($multiArray))
$indexMap[$firstIndex] = $multiArray[$firstIndex][$secondIndex];
if ($dir==0)
asort($indexMap);
else
arsort($indexMap);
while (list($firstIndex, ) = each($indexMap))
if (is_numeric($firstIndex))
$sortedArray[] = $multiArray[$firstIndex];
else $sortedArray[$firstIndex] = $multiArray[$firstIndex];
return $sortedArray;
}
$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);
// Clanstats
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];}
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];}
// Player Stats
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;}
$playerstats[$pid][PLAYERFRAG]=round($playerstats[$pid][PLAYERKILLS]/$playerstats[$pid][PLAYERDEATHS],2);}
// Team Label
echo "<table align=center><tr>";
echo "<tr height=40><td colspan=3 align=center><b>$clanname Team Data:</b><br></td></tr>\n";
echo "</table>";
echo "<br><br>";
// Clan Data
echo "<table align=center style='background-color:#fff'><tr>";
foreach($clanstats as $key => $value) {
echo "<td align=left>Average $key: <td width=10> </td> <td align=left>$value<br></td></tr>\n";}
echo "</table>";
echo "<br><br>";
// player stats
echo "<table align=center>";
echo "<tr height=40><td colspan=15 align=center><b>$clanname Memberstats:</b></td></tr>\n";
echo "<tr>";
echo "<td align=center>Status<br></td>";
echo "<td width=10> </td>";
echo "<td align=center >Name<br></td>";
echo "<td width=10> </td>";
echo "<td align=center>Honor<br></td>";
echo "<td width=10> </td>";
echo "<td align=center>Score<br></td>";
echo "<td width=10> </td>";
echo "<td align=center>Kills<br></td>";
echo "<td width=10> </td>";
echo "<td align=center>Deaths<br></td>";
echo "<td width=10> </td>";
echo "<td align=center>Fragrate<br></td>";
echo "<td width=10> </td>";
echo "<td align=center>Hours Played<br></td>";
echo "</tr>";
// Sort Data definitions
switch ($sort) {
case 1:
$playerstats_sorted=aSortBySecondIndex($playerstats, "PLAYERSTATUS", $dir);
break;
case 2:
$playerstats_sorted=aSortBySecondIndex($playerstats, "PLAYERNAME", $dir);
break;
case 3:
$playerstats_sorted=aSortBySecondIndex($playerstats, "PLAYERHONOR", $dir);
break;
case 4:
$playerstats_sorted=aSortBySecondIndex($playerstats, "PLAYERSCORE", $dir);
break;
case 5:
$playerstats_sorted=aSortBySecondIndex($playerstats, "PLAYERKILLS", $dir);
break;
case 6:
$playerstats_sorted=aSortBySecondIndex($playerstats, "PLAYERDEATHS", $dir);
break;
case 7:
$playerstats_sorted=aSortBySecondIndex($playerstats, "PLAYERFRAG", $dir);
break;
case 8:
$playerstats_sorted=aSortBySecondIndex($playerstats, "PLAYERTIME", $dir);
break;
default:
$playerstats_sorted=aSortBySecondIndex($playerstats, "PLAYERHONOR", 1);}
// Spelerstatvars definiƫren
foreach($playerstats_sorted as $key => $value) {
$playername=$playerstats_sorted[$key][PLAYERNAME];
$playerhonor=$playerstats_sorted[$key][PLAYERHONOR];
$playerurl=$playerstats_sorted[$key][PLAYERSTATSURL];
$playerkills=$playerstats_sorted[$key][PLAYERKILLS];
$playerdeaths=$playerstats_sorted[$key][PLAYERDEATHS];
$playerscore=$playerstats_sorted[$key][PLAYERSCORE];
$playerfrag=$playerstats_sorted[$key][PLAYERFRAG];
$playertime=floor(($playerstats_sorted[$key][PLAYERTIME])/60/60);
//Dump the data in SQL
/* DB CONNECTION CODE HERE */
$conn = mysql_connect("localhost","root","");
mysql_select_db("test", $conn);
$sql = mysql_query("SELECT playername FROM jos_clanstats WHERE playername='$playername' LIMIT -1");
//If result is equal to Playername
if($result !="$playername")
{
//If result did not equal playername insert new field/s
$sql ="INSERT into jos_clanstat VALUES ('$playername','$playerhonor','$playerscore','$playerkills','$playerdeaths','$playerfrag','$playertime','','1')";
}
else
{
// update the fields accordingly
$sql = mysql_query("UPDATE jos_clanstat SET playerhonor='$playerhonor', playerscore='$playerscore', playerkills='$playerkills', playerdeaths='$playerdeaths', playerfrag='$playerfrag', playertime='$playertime' WHERE playername =''");
//process the information
$result = mysql_query($sql, $conn) or die(mysql_error());
// echo the result identifier
echo $result;
$file = "lms.xml";
$feed = array();
$key = "";
$info = "";
}
// Status afbeelding
if($playerstats_sorted[$key][PLAYERSTATUS]=="1")
$statuspic="http://www.lms.org.au/start/myphpfiles/images/ponline.gif";
else
$statuspic="http://www.lms.org.au/start/myphpfiles/images/poffline.gif";
// Fragrate math
if ($playerfrag < 1.0)
$fragratekleur="#ff0000";
elseif ($playerfrag < 2.0)
$fragratekleur="#F9B000";
else
$fragratekleur="#05B605";
// Display the table
echo "<tr style= 'background-color:#fff'>";
echo "<td align=center ><img border=\"0\" src=\"$statuspic\"></td>";
echo "<td width=10></td>";
echo "<td align=left><a target=\"_blank\" href=\"$playerurl\">$playername</a></td>";
echo "<td width=10></td>";
echo "<td align=center>$playerhonor</td>";
echo "<td width=10></td>";
echo "<td align=center>$playerscore</td>";
echo "<td width=10></td>";
echo "<td align=center>$playerkills</td>";
echo "<td width=10></td>";
echo "<td align=center>$playerdeaths</td>";
echo "<td width=10></td>";
echo "<td align=center><font color=$fragratekleur>$playerfrag</font></td>";
echo "<td width=10></td>";
echo "<td align=center>$playertime</td>";
echo "</tr>";}
echo "</table>";
?>
Time to create page: 0.064 seconds