Page 1 of 1

Problems with server status page.

Posted: Mon Sep 23, 2013 8:22 am
by Frostbite952
Hello,

I was able to get this working perfectly on my localhost but soon as I upload it to my web server it does not work.

Does this only work on a localhost?

I have included all the php files.

Any help would be greatly appreciated.
Thanks
Alex

[syntax=php]
<?php

//checks if the given server is online.
function server_online($server, $port)
{
fsockopen($server, $port, $errno, $errstr, 0.1);

return($errno ===0);
}

?>
[/syntax]

[syntax=php]
<?php

$servers = array (
array('',''),
array('',''),
array('',''),

);

error_reporting(0);

include("/servers.inc.php");

?>
[/syntax]

[syntax=php]
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html" />
<meta name="author" content="lolkittens" />

<title>Untitled 4</title>

<style type="text/css">
table {width: 600px: border-collapse: collapse; }
td, th {padding: 4px; border: solid1px #444;}
.online {background: #090;}
.offline {background: #900;}
</style>

</head>

<body>

<div id="server">

<table>
<tr>
<th>Server</th>
<th>Status</th>
</tr>
<tbody>

<?php
require('includes/init.inc.php');

foreach ($servers as $server){
$online = server_online($server[0], $server[1]);
?>
<tr>
<td><?php echo $server[0], ':', $server[1]; ?></td>
<td class="<?php echo ($online) ? 'online':'offline'?>"><?php echo ($online) ? 'Online':'Offline'; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>


</body>
</html>
[/syntax]

Re: Problems with server status page.

Posted: Mon Sep 23, 2013 10:01 am
by Temor
I believe it has to do with your host. They are probably blocking certain ports.
Try sending them an email saying you're trying to send data on those ports and they'll unlock them for you.

Re: Problems with server status page.

Posted: Mon Sep 23, 2013 5:18 pm
by Frostbite952
Ill send them a message.

Thank you for your help.
Alex

Re: Problems with server status page.

Posted: Mon Sep 23, 2013 7:27 pm
by Temor
If they can't help, feel free to come here again! :)