<?php
function ping($target){
$result = array();
/* Execute Shell Command To Ping Target */
$cmd_result = shell_exec("ping -n 1 ". $target);
/* Get Results From Ping */
$result = explode(",",$cmd_result);
/* Return Server Status */
if(@eregi("Lost = 0",$result[1]))
{
return 'offline';
}
elseif(@eregi("Received = 1",$result[1]))
{
return 'online';
}
else{
return 'unknown';
}
}
$target = $_SERVER['REMOTE_ADDR'];
echo $target . ' is ' . ping ( $target );
?>
function ping($target){
$result = array();
/* Execute Shell Command To Ping Target */
$cmd_result = shell_exec("ping -n 1 ". $target);
/* Get Results From Ping */
$result = explode(",",$cmd_result);
/* Return Server Status */
if(@eregi("Lost = 0",$result[1]))
{
return 'offline';
}
elseif(@eregi("Received = 1",$result[1]))
{
return 'online';
}
else{
return 'unknown';
}
}
$target = $_SERVER['REMOTE_ADDR'];
echo $target . ' is ' . ping ( $target );
?>
No comments:
New comments are not allowed.