inherit
189338
0
Oct 2, 2013 11:25:55 GMT -8
darkaln
11
February 2013
darkaln
|
Post by darkaln on Oct 2, 2013 11:25:53 GMT -8
Hello members, I was trying to add server status box onto my forums www.minezoid.proboards.com The point is to show the status of the server whether its online or offline and how many players it has to the people browsing the forums. I did come across a code but unfortunately it was implemented in php. <?php $ip = 's24.hosthorde.com'; $port = 25596;
$onlinePlayers = 0; $maxPlayers = 0; $serverMotd = '';
$serverSock = @stream_socket_client('tcp://'.$ip.':'.$port, $empty, $empty, 1);
if($serverSock !== FALSE) { fwrite($serverSock, "\xfe"); $response = fread($serverSock, 2048); $response = str_replace("\x00", '', $response); $response = substr($response, 2); $data = explode("\xa7", $response); unset($response);
fclose($serverSock);
if(sizeof($data) == 3) { $serverMotd = $data[0]; $onlinePlayers = (int) $data[1]; $maxPlayers = (int) $data[2]; echo $serverMotd.'<br/>'; echo $onlinePlayers.'/'.$maxPlayers.' player(s) online.'; }else{ echo 'Could not connect.'; } }else{ echo 'Server is offline.'; }
?>
Will it be possible to convert this into Proboard friendly html ? It need not be dynamic as in refresh every said minutes. It can be static where the values change whenever someone refreshes the entire page. If someone could take a look at this it would be highly appreciated. Regards, darkaln www.minezoid.proboards.com
|
|