Guapoke
Member
- Joined
- Nov 21, 2008
- Messages
- 259
- Reaction score
- 5
I use sqlite and acc manager. I just want to make a website for news and server status.
I found this script for server status, but I can't make it work right, it's showing all info about the server togheter. I know basics in php so anything would help!
I need it like, for example:
Server status: ONLINE
Players: 12/100
Monsters: xxx
Uptime: xxx
Thanks in advance.
I found this script for server status, but I can't make it work right, it's showing all info about the server togheter. I know basics in php so anything would help!
Code:
<?PHP // config
$server['host'] .= 'xxxx';
$server['port'] .= '7171';
// Verifing
$info = chr(6).chr(0).chr(255).chr(255).'info';
$sock = @fsockopen($server['host'],$server['port'], $errno, $errstr, 1);
if ($sock)
{
fwrite($sock, $info);
$data='';
while (!feof($sock))
$data .= fgets($sock, 4096);
fclose($sock);
$XML = @simplexml_load_string($data);
if($XML){
print_r($XML);
return $XML;
}
}
else
{
$cnf_['players'] .= '0 / 0';
$cnf_['uptime'] = '0';
$cnf_['monsters'] = '0 h 0 m';
}
// Showing
echo $cnf_['players'];
echo $cnf_['uptime'];
echo $cnf_['monsters'];
?>
I need it like, for example:
Server status: ONLINE
Players: 12/100
Monsters: xxx
Uptime: xxx
Thanks in advance.