-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicmpupdate.php
More file actions
30 lines (26 loc) · 756 Bytes
/
icmpupdate.php
File metadata and controls
30 lines (26 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
chdir(dirname(__FILE__));
include_once("config.php");
include_once("lib/db.php");
include_once("lib/ping.php");
include_once("lib/domain/domain.php");
date_default_timezone_set("UTC");
echo date("l jS \of F Y h:i:s A\n");
$ips = getIps();
foreach($ips as $ip) {
// echo "ip: ".$ip->ip."\n";
$time = ping($ip->ip);
if (false !=$time) {
$host = gethostbyaddr($ip->ip);
echo "ip: ".$ip->ip." (".$host.") time: ".$time."\n";
$ip->ping=$time;
$ip->laststatus=1;
$ip->hostname = $host;
saveIp($ip);
} else {
echo "ip: ".$ip->ip." down\n";
$ip->laststatus=0;
saveIp($ip);
}
}
?>