Codigo html
Cita:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PING</title>
<script language="JavaScript" type="text/JavaScript" src="ping.js">
</script>
</head>
<body>
<form name="formulario" id="formulario" action="ping.php" method="post" onSubmit="return validar(this);">
INGRESE IP CPE:<br>
<input type="text" name="cpe" />
<br>
INGRESE IP VPN:<br>
<input type="text" name="vpn" />
<br>
<input type="submit" name="PING" />
</form>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PING</title>
<script language="JavaScript" type="text/JavaScript" src="ping.js">
</script>
</head>
<body>
<form name="formulario" id="formulario" action="ping.php" method="post" onSubmit="return validar(this);">
INGRESE IP CPE:<br>
<input type="text" name="cpe" />
<br>
INGRESE IP VPN:<br>
<input type="text" name="vpn" />
<br>
<input type="submit" name="PING" />
</form>
</body>
</html>
Código PHP:
<?php
$comando = "ping " . $cpe;
$salida = shell_exec($comando);
$JOIN=split("\n",$salida);
$comando2 = "ping " . $vpn;
$salida2 = shell_exec($comando2);
$JOIN2=split("\n",$salida2);
for($i=0; $i<sizeof($JOIN); $i++)
{
echo $JOIN[$i]."<br>";
}
for($i=0; $i<sizeof($JOIN2); $i++)
{
echo $JOIN2[$i]."<br>";
}
?>
Cita:
function validar()
{
with (document.forms['formulario'])
{
if(cpe.value=="")
{
alert("Ingrese la ip CPE");
return false;
}
else if(vpn.value=="")
{
alert("Ingrese la ip VPN");
return false;
}
else
{
return true;
}
}
}
{
with (document.forms['formulario'])
{
if(cpe.value=="")
{
alert("Ingrese la ip CPE");
return false;
}
else if(vpn.value=="")
{
alert("Ingrese la ip VPN");
return false;
}
else
{
return true;
}
}
}