Good afternoon all,
I need some advise. I am using this script to determine the status of a server:
<?php
//Please change to your server specifications
$live = "http://pathtofile/status/live.gif";
$dead = "http://pathtofile/status/dead.gif";
//The status checking script
//meddle at your own risk!
//check for port number, default is 80
list($addr,$port)= explode (':',"$link");
if (empty($port)){
$port = 80;
}
//Test the server connection
$churl = @fsockopen(server($addr), $port, $errno, $errstr, 4);
if (!$churl){
header("Location: $dead");
}
else {
header("Location: $live");
}
function server($addr){
if(strstr($addr,"/")){$addr = substr($addr, 0, strpos($addr, "/"));}
return $addr;
}
?>
When the server is online it shows the live.gif and when it is offline it shows the dead gif. Is there a way to optionally redirect to an alternative webpage based on condition? For example, if it is online it would go to online.html or if offline go to offline.html.
Thank you for your assistance.
Jeremy Bilawa