This script will as the previously posted script, check the current online status but it will output a image instead of text.
Server IPs and ports are defined inside the script so people can't use it script to check whatever they like.
Copy and save the below script into a php file and use
scriptname.php should be replaced with whatever name you give the script.
serverid should be what you name the servers in the script.
The code below shows three ways of setting an array.
will use the next number in the array. This become zero as arrays start on zero and there were none set before this.
... you guessed it, it will be number 11
11 => array('126.96.36.199', 123),
will of course be http. This isn't so hard is it... Remember to use single quotes ( ' ) if you use anything else but numbers.
'http' => array('188.8.131.52', 123),
Fourth and last one is the same as the first. It will use the next number in the array which is now 12 because we set number 11 before.
You either need to save or create two images and put them in the same folder as the script. online.gif () and offline.gif (). If you want to change you'll have to edit the script.
Just copy and paste this into a php file.
# Change the below as following
# array('IP number', Port number);
# Remove the ones you don't use.
$servers = array(
array('184.108.40.206', 123), # Next number in array, zero if first
11 => array('220.127.116.11', 123), # Number 11
'http' => array('18.104.22.168', 123), # Named http
array('22.214.171.124', 123), # This becomes 12 because have set 11
function getConnectionStatus($address, $port)
$sock = fsockopen($address, $port, $errno, $errstr, 5);
if (!empty($sock)) $status = true;
else $status = false;
if (isset($_GET['server']) && array_key_exists($_GET['server'], $servers))
$status = getConnectionStatus($servers[$_GET['server']], $servers[$_GET['server']]);
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 16 Aug 1986 05:00:00 GMT");
if ($status) @readfile('online.gif');