<?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("Destination host unreachable.",$result[2]))
{
return 'offline';
}
else
{
return 'online';
}
}
$target = "192.168.1.2";
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("Destination host unreachable.",$result[2]))
{
return 'offline';
}
else
{
return 'online';
}
}
$target = "192.168.1.2";
echo $target . ' is ' . ping ( $target );
?>
No comments:
Post a Comment