rendered paste body<?
if (extension_loaded('zlib')) @ob_start('ob_gzhandler');
@header("Expires: Mon, 26 Jul 1995 05:00:00 GMT");
@header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@header("Cache-Control: no-cache, must-revalidate");
@header("Pragma: no-cache");
function check_record($current) {
$fp = fopen("record.txt", "r+b");
$record = fread($fp, 10);
if ($record >= $current) return $record;
rewind($fp);
ftruncate($fp, '0');
fwrite($fp, $current);
return $current;
}
?>
<html>
<head>
<title>Zone Status</title>
<link rel=stylesheet href="http://www.infinity-hq.com/files/style.css" type=text/css>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<TABLE width="100%" height="100%" border=0 cellPadding=2 cellSpacing=0>
<TBODY>
<TR class="td3d">
<TD> <table width="100%" cellpadding="0" cellspacing="0">
<tr class="td3d">
<td width="100"><b>Zone</b></td>
<td width="20"><center>#</center></td>
<td width="20"><center>Ping</center></td>
</tr>
<?
$total_online = 0;
$zones = array();
$servers = array(
"Combined Arms/76.74.252.28/2001",
"Decay of Nations/76.74.252.28/2003",
"Fantasy Zone/76.74.252.28/2007",
"Frontlines/76.74.252.28/2005",
"The Arena/76.74.252.28/2009");
foreach ($servers as $server) {
$info = explode("/", $server);
if ($handle = fsockopen('udp://'.$info[1], $info[2])) {
socket_set_timeout($handle, 1);
$request = "0xB2\0x6F\0xA0\0x00";
$timestart = microtime(true);
fwrite($handle, $request);
$timeend = microtime(true);
$online = fread($handle, 4);
if (empty($online)) continue;
$online = unpack('L', $online);
$online = implode($online);
$total_online += $online;
fclose($handle);
$ping = round(($timeend - $timestart)/100);
$zones[] = array("Online" => $online, "Name" => $info[0], "Ping" => $ping);
}
}
$record = check_record($total_online, 'record.txt');
asort($zones, SORT_NUMERIC);
arsort($zones);
foreach ($zones as $zone) {
?>
<tr class='td3d'>
<td width='90%'>
<?=$zone['Name'];?>
</td>
<td width='10%'><font color=green> <center>
<?=$zone['Online'];?>
</center></font></td>
<td width='10%'><font color=green> <center>
<?=$zone['Ping'];?>
</center></font></td>
</tr>
<?
}
?>
<tr class='td3d'>
<td colspan='2' align='center'> </td>
</tr>
<tr class='td3d'>
<td colspan='2' align='center'>Online:
<?=$total_online;?>
</td>
</tr>
<tr class='td3d'>
<td colspan='2' align='center'>
</td>
</tr>
<tr class='td3d'>
<td colspan='2' align='center'>
<?php
echo "<a href=\"http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "\">[Refresh]</a>";
?>
</td>
</tr>
</table></TD>
</TR>
</TABLE>
</body>
</html>