Foros del Web » Programando para Internet » PHP »

Ayuda con script para server on/off

Estas en el tema de Ayuda con script para server on/off en el foro de PHP en Foros del Web. hola gente. me podrian orientar o decir porque el siguiente script no me funciona.. <?php print'<table width="100">'; $server = "aqui. pongo.mi.ip"; $portg = "7777"; $portl ...
  #1 (permalink)  
Antiguo 18/10/2010, 06:32
 
Fecha de Ingreso: octubre-2010
Mensajes: 2
Antigüedad: 13 años, 6 meses
Puntos: 0
Ayuda con script para server on/off

hola gente.


me podrian orientar o decir porque el siguiente script no me funciona..


<?php
print'<table width="100">';
$server = "aqui. pongo.mi.ip";
$portg = "7777";
$portl = "2106";
$timeout = "5";

if ($server and $port and $timeout) {
$game = @fsockopen($server, $portg, $portl, $errno, $timeout);
$login = @fsockopen($server, $portl, $portl, $errno, $timeout);
}
if($login) { print'<p>Login:<font color="#00FF00"><strong> OnLine</strong></font></p>'; }
else { print'<p>Login:<font color="#FF0000"><strong> OffLine</strong></font></p>'; }

if($game) { print'<p>Server:<font color="#00FF00"><strong> OnLine</strong></font></p>'; }
else { print'<p>Server:<font color="#FF0000"><strong> OffLine</strong></font></p>'; }
print'</table>';
?>


saludos y gracias
  #2 (permalink)  
Antiguo 18/10/2010, 11:48
Avatar de repara2  
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: Ayuda con script para server on/off

Hola Evil, hay un par de variables indefinidas, además el and no funciona, tiene que ser &&, compara con este código (funciona):

Código PHP:
<?php
print'<table width="100">';
$server "127.0.0.1";
$portg "3306";
$portl "80";
$timeout "5";

if (
$server && $portg && $timeout) {
    
$game = @fsockopen($server$portg$portl$errno$timeout);
    
$login = @fsockopen($server$portl$portl$errno$timeout);
}
if(
$login) { print'<p>Login:<font color="#00FF00"><strong> OnLine</strong></font></p>'; }
else { print
'<p>Login:<font color="#FF0000"><strong> OffLine</strong></font></p>'; }

if(
$game) { print'<p>Server:<font color="#00FF00"><strong> OnLine</strong></font></p>'; }
else { print
'<p>Server:<font color="#FF0000"><strong> OffLine</strong></font></p>'; }
print
'</table>';
?>
espero que sirva, saludos
  #3 (permalink)  
Antiguo 18/10/2010, 16:59
 
Fecha de Ingreso: octubre-2010
Mensajes: 2
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: Ayuda con script para server on/off

Muchas gracias.. Lo probare de inmediato

Etiquetas: server
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:38.