View Full Version : swap image

12-23-2007, 11:02 AM

i have a php script that checks that a domain is working, its effectivly a status page so i can check all the domains i have are working ok without visiting each site individually.

The php script is:


$live = "live_green.gif";
$dead = "dead_red.gif";

$link = $_GET['link'].":";
$s_link = str_replace("::", ":", $link);
list($addr,$port)= explode (':',"$s_link");
if (empty($port)){
$port = 80;

$churl = @fsockopen(server($addr), $port, $errno, $errstr, 20);
if (!$churl){

header("Location: $dead");
else {
header("Location: $live");
function server($addr){
if(strstr($addr,"/")){$addr = substr($addr, 0, strpos($addr, "/"));}
return $addr;

and then i reference that through an image tag like so: <img src="status.php?link=www.microsoft.com">

it then returns a green or red blob to show the status.

the problem i have is with the large amount of domains, the page can take a while to load and the blobs dont appear instantly so i would like to show a little loading gif image whilst the blobs are loading, any ideas how to do this? i have seen it on a few sites but cant figure it out...

SeeIT Solutions
12-23-2007, 02:04 PM
Set a background image on the img tag. Make that a loading gif. Once it is loaded it will appear in all backgrounds and then be covered by the actual image.

12-23-2007, 05:57 PM
perfect thankyou!