Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/05/2008, 19:02
nikolo14
 
Fecha de Ingreso: mayo-2008
Mensajes: 13
Antigüedad: 16 años
Puntos: 0
Ayuda con codigo status server

Primero parto con lo que deseo lograr:

Mi objetivo es un codigo que visualice una o otra imagen segun el estado de un servidor (juego)- OFFLINE y ONLINE- quero un resultado como el que da esta pagina: http://status.blackout-gaming.net/ el unico problema es que ellos designan las imagenes.

Entonces deseo crear yo el codigo y poseo lo siguiente:
Status.php
Cita:
<?php
//Web Server Status v 1.4, Copyright 2002 By Ryan Schwiebert, visit http://www.schwebdesigns.com/
//This script may be freely distributed providing all copyright headers are kept intact.

//Concept from:
//Abax Server Status v1.04, Copyright 2002 By Nathan Dickman, visit http://www.NathanDickman.com/
//Location of the live or dead server images

//Please change to your server specifications
$live = "http://www.schwebhost.com/status/live.gif";
$dead = "http://www.schwebhost.com/status/dead.gif";

//The status checking script
//meddle at your own risk!
//check for port number, default is 80
$link = $_GET['link'].":";
$s_link = str_replace("::", ":", $link);
list($addr,$port)= explode (':',"$s_link");
if (empty($port)){
$port = 44405;
}
//Test the server connection
$churl = @fsockopen(server($addr), $port, $errno, $errstr, 20);
if (!$churl){
//echo $errstr;
header("Location: $dead");
}
else {
header("Location: $live");
}
function server($addr){
if(strstr($addr,"/")){$addr = substr($addr, 0, strpos($addr, "/"));}
return $addr;
}
?>
Ese es el codigo y para hacerlo funcionar utilizo esta etiqueta:

Cita:
<img src="status.php?link=www.redhat.com" width="37" height="20">
Porfavor necesito ayuda para generar un codigo nuevo o lograr hacer funcionar este

PD: Con ese codigo me visualiza offline siempre aunque este se encuentre en linea =(