Comunidad de diseño web y desarrollo en internet online

Hola! Ayuda con una variable Get

Citar            
MensajeEscrito el 06 Feb 2010 03:35 pm
Bueno, pues este es mi problema:
estoy haciendo un sistema para comprobar el estado de un servidor.
(http://www.roftorium.com/status.php)
Como podeis ver funciona perfectamente, pero me gustaría añadirle la variable get para que en función de lo que elija
el usuario pueda cambiar la imágen ejemplo:
http://www.roftorium.com/image.php?roftorium.com:80&style=1

&style=2, &style=3

Cada uno con una imagen ON y OFF diferente

image.php:
<?php
header('Content-type: image/gif');

error_reporting(0);

$var=explode('@',$_SERVER['QUERY_STRING']);
$status=@fsockopen($var[0],$var[1]);
if(!$status)
readfile('offline.gif');
else
readfile('online.gif');
}
?>


Gracias

Por Olimpus

3 de clabLevel



 

firefox
Citar            
MensajeEscrito el 07 Feb 2010 02:28 am
¿Qué te impide usar $_GET["style"]?

Por DriverOp

Claber

2510 de clabLevel



 

opera
Citar            
MensajeEscrito el 07 Feb 2010 09:07 am
pues nada, pero el problema es que no se hacerlo u_U
poner la variable si. pero el código para que cambie la imágen no xD

Por Olimpus

3 de clabLevel



 

firefox
Citar            
MensajeEscrito el 08 Feb 2010 06:04 am
Pues...

Código PHP :

$val = @$_GET["style"];
if ($val == 1) { readfile('online.gif'); }
else { readfile('offline.gif');


¿O no entendí el problema? :S

Por DriverOp

Claber

2510 de clabLevel



 

opera
Citar            
MensajeEscrito el 09 Feb 2010 05:18 pm
sisi lo has entendido perfectamente x)

http://www.roftorium.com/image.php?roftorium.com:80&style=1

Pero no funciona D:

Por Olimpus

3 de clabLevel



 

firefox
Citar            
MensajeEscrito el 09 Feb 2010 08:35 pm
Pues será que tienes mal formados los parámetros en la URL, por qué no pruebas con:

http://www.roftorium.com/image.php?url=roftorium.com:80&style=1

Por DriverOp

Claber

2510 de clabLevel



 

opera
Citar            
MensajeEscrito el 10 Feb 2010 05:51 am
listo! encontré la solución X)
Muchas gracias .

Por Olimpus

3 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.