All pastes #452495 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-22 09:45 UTC
rendered paste body
<html>
<head>
<title>Server stats - BETA</title>
</head>
<body>
</body>
</html>
<?php

/*
Server status - An information tool about Anarchy-Online
servers and stats
*/

	$handle = fopen('http://probes.funcom.com/ao.xml', 'r');
	while(!feof($handle)) $dump .= fgets($handle, 1024);
	preg_match_all("#<playfield id=\"[0-9]+\" name=\"([a-zA-Z0-9- ]+)\" status=\"([0|1])\" load=\"[0-9]+\" players=\"([0-9\.%]+)\"/>#is", $dump, $match);
	preg_match_all("#<servermanager status=\"([0|1])\"/>#is", $dump, $servermatch);
	preg_match_all("#<clientmanager status=\"([0|1])\"/>#is", $dump, $loginmatch);
	preg_match_all("#<chatserver status=\"([0|1])\"/>#is", $dump, $chatmatch);
	preg_match_all("#<omni percent=\"([0-9\.0-9]+)\"/>#is", $dump, $omnimatch);
	preg_match_all("#<clan percent=\"([0-9\.0-9]+)\"/>#is", $dump, $clanmatch);
	preg_match_all("#<neutral percent=\"([0-9\.0-9]+)\"/>#is", $dump, $neutmatch);
	
	// Atlantean statuses
	echo '<h3>Server Info & Stats for Atlantean:</h3>';
	if($servermatch[1][0] == 1) echo 'Server: <font color="green">Online!</font>';
	else echo 'Server: <font color="red">Offline!</font>';
	
	echo '<br>';
	
	if($loginmatch[1][0] == 1) echo 'Loginserver: <font color="green">Online!</font>';
	else echo 'Loginserver: <font color="red">Offline!</font>';
	
	echo '<br>';
	
	if($chatmatch[1][0] == 1) echo 'Chatserver: <font color="green">Online!</font>';
	else echo 'Chatserver: <font color="red">Offline!</font>';
	
	echo '<br><br>';
	
	echo "<b>Omni</b> percent of characters online &raquo; {$omnimatch[1][0]}%";
	echo "<br>";
	echo "<b>Clan</b> percent of characters online &raquo; {$clanmatch[1][0]}%";
	echo "<br>";
	echo "<b>Neutral</b> percent of characters online &raquo; {$neutmatch[1][0]}%";

	echo '<br><br>';

	for($i = 0; $i <= 70; $i++)
	{
		echo "<b>{$match[1][$i]}</b> &raquo;&raquo; {$match[3][$i]} of players &raquo;&raquo;";
		
		if ($match[2][$i] == 1) echo "<font color='green'> Online!</font>";
		else echo "<font color='red'> Offline!</font>";
		
		echo "<br>";
	}
?>