print "Warning: Threading is not supported!\n"; $m = 0; //Array count //scan each foreach ($addresses as $ip) { //calculate diff since last alive $tDiff = time() - strtotime($ip['lastSeen']); //set Old status if ($tDiff < $statuses[1]) { $addresses[$m]['oldStatus'] = 0; } else { $addresses[$m]['oldStatus'] = 2; } //old offline //get status $code = pingHost(transform2long($ip['ip_addr']), $count, false); //Online if ($code == "0") { //update IP status @updateLastSeen($ip['id']); //set new seen $addresses[$m]['newSeen'] = date("Y-m-d H:i:s"); } else { $code = 2; } //save new status $addresses[$m]['newStatus'] = $code; //check for status change if ($addresses[$m]['oldStatus'] != $code) { $stateDiff[] = $addresses[$m]; //save to change array
/* verify that user is logged in */ isUserAuthenticated(false); // verify that user has write access $subnetPerm = checkSubnetPermission($_POST['subnetId']); if ($subnetPerm < 2) { echo _("error") . ":" . _("Insufficient permissions"); die; } //get IP address details $ip = getIpAddrDetailsById($_POST['id']); //verify that pign path is correct if (!file_exists($pathPing)) { $pingError = true; } //try to ping it if (pingHost($ip['ip_addr'], 1) == '0') { $status = "Online"; @updateLastSeen($_POST['id']); // <eNovance> // Set the new state of an ip addresse if (intval($ip['state']) == 0) { $database = new database($db['host'], $db['user'], $db['pass'], $db['name']); $query = 'UPDATE ipaddresses SET state = 1 WHERE id = ' . $ip['id'] . ';'; $database->executeQuery($query); } } else { $status = "Offline"; if (intval($ip['state']) == 1) { $database = new database($db['host'], $db['user'], $db['pass'], $db['name']); $query = 'UPDATE ipaddresses SET state = 0 WHERE id = ' . $ip['id'] . ';'; $database->executeQuery($query);
*/ /* include required scripts */ require_once '../../functions/functions.php'; require_once dirname(__FILE__) . '/../../functions/scan/config-scan.php'; /* verify that user is logged in */ isUserAuthenticated(false); // verify that user has write access $subnetPerm = checkSubnetPermission($_POST['subnetId']); if ($subnetPerm < 2) { echo _("error") . ":" . _("Insufficient permissions"); die; } //get IP address details $ip = getIpAddrDetailsById($_POST['id']); //try to ping it $pingRes = pingHost($ip['ip_addr'], 1, 1); //update last seen if success if ($pingRes == 0) { @updateLastSeen($_POST['id']); } ?> <!-- header --> <div class="pHeader"><?php print _('Ping check result'); ?> </div> <!-- content --> <div class="pContent">