Ver Mensaje Individual
  #6 (permalink)  
Antiguo 12/04/2014, 10:28
Qazser
 
Fecha de Ingreso: abril-2014
Ubicación: Canarias!
Mensajes: 150
Antigüedad: 10 años
Puntos: 10
Respuesta: Problema con continuación de página

Está fallando por los ":" que no los has puesto..peeeeroooo si tienes un bloque de 3 lineas de php no es necesario abrir y cerrar cada vez..Pongo un ejemplo de como dejaria yo el codigo en el mismo archivo

Código PHP:
<?php
function pingDomain($domain){
    
$starttime microtime(true);
    
$file      fsockopen ($domain80$errno$errstr10);
    
$stoptime microtime(true);
    
$status    0;
    if (!
$file$status = -1;
    else {
        
fclose($file);
        
$status = ($stoptime $starttime) * 1000;
        
$status floor($status);
    }
    return 
$status;
}
?>
<form id="InWP" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" name="domain" id="domain">
<center>
<input size="50" type="text" name="domainname" id="domainname">
<br />
<input value=" Realizar PING " type="submit" name="submitBtn">
</center>
</form>
<br />
<div id="ResDiv">

<?php
if (isset($_POST['submitBtn'])){
    
$domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : '';
    
$domainbase str_replace("http://","",strtolower($domainbase));
}

$status pingDomain($domainbase);
 if (
$status != -1) echo "Los resultados del PING de $domainbase son:<br><br>ONLINE - Se ha obtenido respuesta ($status ms)";
else echo 
"Los resultados del PING de $domainbase son:<br><br>OFFLINE - No se ha obtenido respuesta"
?>
</div>
Principalmente he quitado aberturas y cierres del php inecesarios...el if, else, endif está pensado cuando tienes que abrir y cerrar mucho php por html en medio, pero si vas a imprimir html con un echo no hace falta.

Con esto he limpieado algo pero seguimos sin saber que fallo hace que no se vea la publicidad.