Note that you need to put up.png and down.png and use cs function to get information on specific service running on IP/Port.
Code: Select all
<?php
function cs($hostip, $port)
{
if (!$ifcs = @fsockopen($hostip, $port, $errno, $errstr, 1)) // attempt to connect
{
echo '<img src="/up.png" alt="Up" />';
}
else
{
echo '<img src="/down.png" alt="Down" />';
if ($ifcs)
{
@fclose($ifcs); //close connection
}
}
}
$u = shell_exec('uptime');
?>
<h2>Server uptime</h2> <?php echo $u; ?><br />
<h2>Current status</h2>
HTTP: <?php cs('192.168.0.1','80'); ?><br />