| Zone |
# |
Ping |
$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) {
?>
|
=$zone['Name'];?>
|
=$zone['Online'];?>
|
=$zone['Ping'];?>
|
}
?>
| |
| Online:
=$total_online;?>
|
|
|
|
[Refresh]";
?>
|
|