<?php
//ini_set('zlib.output_compression_level', 1);
ob_start("ob_gzhandler");
require('./bf2s-ml.php');
$mlb->debug = true;
$rankmax1 = "150";
$rankmax2 = "500";
$rankmax3 = "800";
$rankmax4 = "2500";
$rankmax5 = "5000";
$rankmax6 = "8000";
$rankmax7 = "20000";
$rankmax8 = "20000";
$rankmax9 = "50000";
$rankmax10 = "50000";
$rankmax11 = "250000";
$rankmax12 = "200000";
$rankmax13 = "500000";
$time = number_format($time/3600, 2);
$spm = number_format($spm, 2);
if ($rank == '0') {
$progress = Round(($score / $rankmax1) * 100, 2) . "%";
} else if ($rank == '1') {
$progress = Round(($score / $rankmax2) * 100, 2) . "%";
} else if ($rank == '2') {
$progress = Round(($score / $rankmax3) * 100, 2) . "%";
} else if ($rank == '3') {
$progress = Round(($score / $rankmax4) * 100, 2) . "%";
} else if ($rank == '4') {
$progress = Round(($score / $rankmax5) * 100, 2) . "%";
} else if ($rank == '5') {
$progress = Round(($score / $rankmax6) * 100, 2) . "%";
} else if ($rank == '6') {
$progress = Round(($score / $rankmax7) * 100, 2) . "%";
} else if ($rank == '7') {
$progress = Round(($score / $rankmax8) * 100, 2) . "%";
} else if ($rank == '8') {
$progress = Round(($score / $rankmax9) * 100, 2) . "%";
} else if ($rank == '9') {
$progress = Round(($score / $rankmax10) * 100, 2) . "%";
} else if ($rank == '10') {
$progress = Round(($score / $rankmax11) * 100, 2) . "%";
} else if ($rank == '11') {
$progress = Round(($score / $rankmax12) * 100, 2) . "%";
} else if ($rank == '12') {
$progress = Round(($score / $rankmax13) * 100, 2) . "%";
}
$rankkeys = array(
"0" => "Private",
"1" => "Private First Class",
"2" => "Lance Corporal",
"3" => "Corporal",
"4" => "Sergeant",
"5" => "Staff Sergeant",
"6" => "Gunnery Sergeant",
"7" => "Master Sergeant",
"8" => "First Sergeant",
"9" => "Master Gunnery Sergeant",
"10" => "Sergeant Major",
"11" => "Sergeant Major of the Corps",
"12" => "2nd Lieutenant"
);
function sec2log($seconds) {
$h = floor($seconds / 3600);
$m = floor(($seconds % 3600) / 60);
$s = floor(($seconds % 3600) % 60);
$h=sprintf("%02d", $h);
$m=sprintf("%02d", $m);
$s=sprintf("%02d", $s);
return "{$h}:{$m}:{$s}";
}
?>
<html>
<head>
<title>BF2XML Stats Leaderboard</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="mlb.js" ></script>
<link rel="stylesheet" href="mbl.css" type="text/css" />
</head>
<body bgcolor="#FFFFFF" leftmargin="0" marginwidth="0">
<?php
//no more than 64 pid's per request! Anything more than 64 get's ignored...
//NO NAMES! PID's ONLY!
//just a bunch(40) of PID's from various EA leader boards. Replace with your own.
//these all get joined together into a new var, and sent as one string later..
$PIDlist = array(
"squad_a" => "44270258,46186163,44133555,49030723,49441703,48156970,49310307,44133555",
);
//turn the PID's into multi-dimensional arrays, for comparing against the XLM cache, and multiple group tables.
$squadgroup = array();
foreach( $PIDlist as $k => $v ) {
$v = preg_replace('/\s/', '', $v); //strip all whitespaces (jic)
$grouppid .= $v . ","; //add all pid's into one string for feed
$squadgroup[$k] = explode(',', $v);
}
if( substr($grouppid,-1, 1) == ","); //better check it first
$grouppid = substr($grouppid,0,strlen($grouppid)-1); //trim off the last comma
$mlb->get($grouppid); //get raw xml data array
?>
<form name="compare" method="post">
<input type="hidden" name="pid1">
<input type="hidden" name="pid2">
<input type="hidden" name="url">
<p align="center">
<table border="0" cellpadding="0" cellspacing="0" width="60%">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left"><input type="button" name="redir" value="vergleichen" onClick="setItems_redir();" disabled> Wähle 2 Spieler und vergleiche die Stats!</td>
</tr>
</table>
<?php
$leadercache = $mlb->getList('score'); //only need to call this once, default sort by 'score'
foreach( $squadgroup as $group => $squad ) { //cycle through each group array
?>
<table border="0" cellpadding="0" cellspacing="0" id="<?=$group?>" class="leader sortable" width='640'">
<tr>
<th style="padding: 0px 6px; text-align: right;" width="16" class="nosort" id="hdr"><img src="images/compare.gif" alt="Player Compare" width="16" height="16" style="border: 0;"/></th>
<th width="16" class="nosort" id="hdr"> </th>
<th style="padding-left: 4px; text-align: left;" id="hdr"></th>
<th style="padding-left: 4px; text-align: left;" id="hdr">Spielername</th>
<th style="padding-: 0px 6px; text-align: right;" id="hdr">Punkte</th>
<th style="padding: 0px 6px; text-align: right;" id="hdr">Pkt/min</th>
<th style="padding: 0px 6px; text-align: right;" id="hdr">Spielzeit</th>
<th style="padding: 0px 6px; text-align: right;" id="hdr">Next Rank</td>
</tr>
<?php
foreach( $leadercache as $players ) { //cycle through each sub-array
if ( in_array($players['PID'], $squad) ) { //verify, else loop
?>
<tr>
<td valign="middle" width="16" nowrap><input type="checkbox" name="compare" value="<?=$players['PID']?>" onclick="setItems(this);"></td>
<td align='center'><img src='images/bf2tracker/CountryIcons/DE.gif'></td>
<td valign="middle" width="16" nowrap><img src="images/rank_small_<?=$players['RANK']?>.gif" alt="<?=$rankkeys[$players['RANK']]?>" style="border: 0;"/></td>
<td valign="middle" width="35%" style="padding-left: 4px; text-align: left;"><a href="<?=$players['LINK']?>" target="_blank"><?=$players['NICK']?></a></td>
<td align='left'><?=number_format($players['SCORE'], 0, ',', ',')?></td>
<td align='left'><?=number_format($players['SPM'], 2)?></td>
<td><?=sec2log($players['TIME'])?></td>
<td align='left'><img src='images/bar.gif' width='$progress' height='10' alt='$progress - $score'></td>
</tr>
<?php
}
}
?>
</table>
<br />
<?php
}
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="right"><?php echo "Last Update: " . $mlb->cacheage; ?><br /><?php echo "Next Update: " . $mlb->nextrefresh; ?></td>
</tr>
</table>
</td>
</tr>
</table>
</p><p style="text-align:right;font-size:90%;">Stats powered by <a href="http://www.bf2s.com/" target="blank">BF2S.com</a> <br />
<a href="http://bf2s.com/my-leaderboard.php?pids=44270258,46186163,44133555,49030723,49441703,48156970,49310307,44133555" target="blank">Official Leaderbord</a> by <a href="http://www.bf2s.com/" target="blank">BF2S.com</a> <br><style="text-align:right;font-size:90%;">Script by <a href="http://www.mscwar.com/" target="blank">NM156</a> </p>
</form>