m4tri_x
(usa Ubuntu)
Enviado em 16/11/2007 - 11:16h
ae criei um tb, não lembro ainda se funciona, mais da uma olhada ai, as vezes vc consegui tirar algo para corrigir o seu script, ou não... fiz em php e vc precisa do xajax pra rodar, eh simples de baixar eh soh ir no google e digitar: xajax
[]´s
---inicio---
<?
require_once("../comando/xajax.inc.php");
function testping($formData1)
{
$objResponse = new xajaxResponse();
$ipini = $formData1['ini'];
$ipfim = $formData1['fim'];
$ipiniar = array($ipini);
$ipiniar1 = explode(".", $ipiniar[0]);
$ipini4 = $ipiniar1[3];
$ipfimar = array($ipfim);
$ipfimar1 = explode(".", $ipfimar[0]);
$ipfim4 = $ipfimar1[3];
for($i = $ipini4; $i<=$ipfim4;$i++){
$ip = $ipiniar1[0].".".$ipiniar1[1].".".$ipiniar1[2].".".$i."";
$shell = shell_exec("ping -s4 -c1 $ip |grep '1 received'");
if($shell != "")
$results = "$ip , $shell"; #$ip <font size=2 color=green><b>On-Line</b></font>";
else
$results = "$ip , off"; #$ip <font size=2 color=red><b>Off-Line</b></font>";
$resultss .= "$results<br>";
}
$objResponse->addAssign("resultping","innerHTML", $resultss);
return $objResponse->getXML();
}
function gethost($formData)
{
$objResponse = new xajaxResponse();
$tmp = $formData['domain'];
$ip = gethostbyname($tmp);
if($tmp == $ip)
$stats = "<font color=red>Off-line</font>";
else
$stats = "<font color=green>On-line</font>";
$result = "Dominio: $tmp <br>IP: $ip<br>Status: $stats";
$objResponse->addAssign("resolv","innerHTML", $result);
return $objResponse->getXML();
}
$xajax = new xajax();
$xajax->registerFunction("gethost");
$xajax->registerFunction("testping");
$xajax->processRequests();
?>
<html>
<head>
<? $xajax->printJavascript(); ?>
</head>
<form name=teste>
<table border=1>
<tr><td>Ip/Domain Teste: <input type=text name=domain></td><td>
<input type=button name=ss value=Get onclick="xajax_gethost(xajax.getFormValues(teste))">
<br><br>
<div id="resolv"></div></td></tr>
</form>
</table>
<table border=1>
<form name=ping>
<tr><td>Ping por Faixa:</td></tr><tr><td>Inicial:<input type=text name=ini></td><br><td>Final:<input type=text name=fim></td><td><input type=button value=Test onclick="xajax_testping(xajax.getFormValues(ping))"></td></tr>
<tr><td><div id=resultping></div></td></tr>
</table>
</form>
</html>