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:
Ese es el codigo y para hacerlo funcionar utilizo esta etiqueta:<?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;
}
?>
//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;
}
?>
Cita:
Porfavor necesito ayuda para generar un codigo nuevo o lograr hacer funcionar este <img src="status.php?link=www.redhat.com" width="37" height="20">
PD: Con ese codigo me visualiza offline siempre aunque este se encuentre en linea =(