Hello,
Ive got problem with server status and server uptime on website. This is how it looks like:

It always "offline" even is server is online ;/
2nd problem is that when server if offline uptime stops on the last server check so in this case is 13 mins.
How to repair these 2 things?
status server.php
and uptime.php
and this is confing and functions .php
Ive got problem with server status and server uptime on website. This is how it looks like:
It always "offline" even is server is online ;/
2nd problem is that when server if offline uptime stops on the last server check so in this case is 13 mins.
How to repair these 2 things?
status server.php
PHP:
<div class="header"><center>Status Serwera</center></div>
<div class="online">
<ul><table cellpadding="3" cellspacing="0" border="0" width="100%"> <tr><td><?PHP
if($config['status']['serverStatus_online'] == 0)
echo'<b>Serwer:</b> <font color="green">Online</font>';
else
echo'<b>Serwer:</b> <font color="red">Offline</font>';
?> </tr></td>
and uptime.php
PHP:
<tr><td><b>Uptime: </b><?php echo $config['status']['serverStatus_uptime']; ?></td></tr>
and this is confing and functions .php
PHP:
}
$statustimeout = 1;
foreach(explode("*", str_replace(" ", "", $config['server']['statusTimeout'])) as $status_var)
if($status_var > 0)
$statustimeout = $statustimeout * $status_var;
$statustimeout = $statustimeout / 1000;
$config['status'] = parse_ini_file('config/serverstatus');
if($config['status']['serverStatus_lastCheck']+$statustimeout < time())
{
$config['status']['serverStatus_checkInterval'] = $statustimeout+3;
$config['status']['serverStatus_lastCheck'] = time();
$info = chr(6).chr(0).chr(255).chr(255).'info';
$sock = @fsockopen("localhost", 7171, $errno, $errstr, 1);
if ($sock)
{
fwrite($sock, $info);
$data='';
while (!feof($sock))
$data .= fgets($sock, 1024);
fclose($sock);
preg_match('/players online="(\d+)" max="(\d+)"/', $data, $matches);
$config['status']['serverStatus_online'] = 1;
$config['status']['serverStatus_players'] = $matches[1];
$config['status']['serverStatus_playersMax'] = $matches[2];
preg_match('/uptime="(\d+)"/', $data, $matches);
$h = floor($matches[1] / 3600);
$m = floor(($matches[1] - $h*3600) / 60);
$config['status']['serverStatus_uptime'] = $h.'h '.$m.'m';
preg_match('/monsters total="(\d+)"/', $data, $matches);
$config['status']['serverStatus_monsters'] = $matches[1];
}
else
{
$config['status']['serverStatus_online'] = 1;
$config['status']['serverStatus_players'] = 1;
$config['status']['serverStatus_playersMax'] = 1000;
}