[TASK] Added a plugin that would have been ignored otherwise.
This commit is contained in:
parent
6b39d44754
commit
accf74f3a1
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
#BOT_INCLUDE "#botted" "channel" "0"
|
||||||
|
|
||||||
|
if(!function_exists("ping_ip")){
|
||||||
|
|
||||||
|
function ping_ip($ip){
|
||||||
|
$r = "";
|
||||||
|
$cmd = "ping ".escapeshellarg($ip)." -c 1 -w 1";
|
||||||
|
echo $cmd."\n";
|
||||||
|
$p = popen($cmd, "r");
|
||||||
|
while(!feof($p)) $r .= fread($p, 16384);
|
||||||
|
pclose($p);
|
||||||
|
|
||||||
|
if(preg_match("/time=/", $r)) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($this -> ipcs AS $ip => $data){
|
||||||
|
if(time() - $data["lastcheck"] > 10){
|
||||||
|
$result = ping_ip($ip);
|
||||||
|
$status = ($result) ? "Online" : "Offline";
|
||||||
|
if($data["status"] != $result) $this -> call("privmsg", "#botted", "[".$ip."] Status: ".$status);
|
||||||
|
$this -> ipcs[$ip]["status"] = $result;
|
||||||
|
$this -> ipcs[$ip]["lastcheck"] = time();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue