Joa da hast Du wohl recht. Das stellt mich dann aber nur vor ein weiteres (für mich noch unlösbares) Problem.
Wollte erstmal versuchen nur die Funktionen der Scripte ineinander zu kopieren um dann einfach noch das entsprechende in den $content aus der Original-Online-Box zu basteln, und selbst das hat nicht geklappt
<?php
if (!defined('main')) {die("no direct access");}
/*
* Kopiert aus AAOTracker 1.1
*/
$clanid = "8324";
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");
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, 'http://aaotracker.com/livefeed/xml_clanprofile.php?clanid='.$clanid.'');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$xmllink = curl_exec($ch);
curl_close($ch);
$data = xml_parse($xml_parser,$xmllink);
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];
}
// 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;}
$playerstats[$pid][PLAYERFRAG]=@round($playerstats[$pid][PLAYERKILLS]/$playerstats[$pid][PLAYERDEATHS],2);
}
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);
}
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];
$playerkdr = $playerstats_sorted[$key][PLAYERFRAG];
$playerscore=$playerstats_sorted[$key][PLAYERSCORE];
$playerlscore=$playerstats_sorted[$key][PLAYERLEADERSCORE];
$playergscore=$playerstats_sorted[$key][PLAYERGOALSCORE];
$playertime=floor(($playerstats_sorted[$key][PLAYERTIME])/60/60);
$status = ($playerstats_sorted[$key]['PLAYERSTATUS']=="1") ? '<img src="include/images/tracker/online.gif" alt="online" />' : '<img src="include/images/tracker/offline.gif" alt="offline" />';
}
/*
* Ende Kopie
*/
$dif = date('Y-m-d H:i:s', time() - 60);
$abf = "SELECT uid FROM `prefix_online` WHERE uptime > '". $dif."'";
$resultID = db_query($abf);
$brk='';
$uid = array();
$guests = 0;
$guestn = $lang['guests'];
$content='';
while ($row = db_fetch_object($resultID)) {
if ($row->uid != 0 AND $brk!=$row->uid) {
$name=@db_result(db_query('SELECT name FROM prefix_user WHERE id='.$row->uid),0);
$content.= '<tr><td><img src="include/images/icons/online.gif" border="0" alt="online"></td>';
$content.='<td><a href="index.php?user-details-'.$row->uid.'">'.$name.'</a></td></tr>'."\n";
$uid[] = $row->uid;
}
if ($row->uid == 0) { $guests++; }
$brk=$row->uid;
}
if ($guests == 1) { $guestn = $lang['guest']; }
if (empty($content)) { $content.='<tr><td><img src="include/images/icons/offline.gif" border="0" alt="offline"></td><td><font color="#003366">0 User </font></td></tr>'."\n"; }
$content.='<tr><td colspan="2"><hr style="height: 0px; border: dashed #9AB1C8 0px; border-top-width: 1px;"></td></tr>'."\n";
$where = (count($uid)>0) ? 'WHERE id NOT IN ('.implode(', ', $uid).')' : '';
$abf2 = 'SELECT * FROM prefix_user '.$where.' ORDER BY llogin DESC LIMIT 0,5';
$erg2 = db_query($abf2);
while ($row2 = db_fetch_object($erg2)) {
$datum = date('H:i d.m.y',$row2->llogin);
$user = $row2->name;
$content.='<tr><td><img src="include/images/icons/offline.gif" border="0" alt="offline"></td><td><a href="index.php?user-details-'.$row2->id.'" title="'.$lang['lasttimeonline'].$datum.'">'.$user.'</a></td></tr>'."\n";
}
if ($guests == 0) {
$content.= '<tr><td colspan="2"><hr style="height: 0px; border: dashed #9AB1C8 0px; border-top-width: 1px";></td></tr>'."\n".'
<tr><td><img src="include/images/icons/offline.gif" border="0" alt="offline"></td><td><font size="-1" color="#003366">0 '.$lang['guests'].'</td></tr>'."\n";
} else {
$content.= '<tr><td colspan="2"><hr style="height: 0px; border: dashed #9AB1C8 0px; border-top-width: 1px;"></td></tr>'."\n".'
<tr><td><img src="include/images/icons/online.gif" border="0" alt="online"></td><td><font size=-1>'.$guests.' '.$guestn.'</font></td></tr>'."\n";
}
?>
<table align="center" border="0" cellpadding="0" cellspacing="0" >
<?php echo $content; ?>
</table>
Denn das ergibt die Fehler:
Warning: array_push() [function.array-push]: First argument should be an array in /prmhgpnj/www.prma.eu/include/boxes/online+track.php on line 13
Warning: arsort() expects parameter 1 to be array, null given in /prmhgpnj/www.prma.eu/include/boxes/online+track.php on line 34
Warning: Variable passed to each() is not an array or object in /prmhgpnj/www.prma.eu/include/boxes/online+track.php on line 35
Warning: Invalid argument supplied for foreach() in /prmhgpnj/www.prma.eu/include/boxes/online+track.php on line 111
Das sind ja alles sehr dilletantische Ansätze meinerseits. Bitte helft einem armen Unwissenden!