Private GIT

Skip to content
Snippets Groups Projects
Commit b52de577 authored by Daniel's avatar Daniel
Browse files

Fix saving the mac address

parent bd0bc685
No related branches found
No related tags found
No related merge requests found
......@@ -72,7 +72,7 @@ if (sizeof($all_subnet_hosts)>0) {
$result[$Subnets->transform_address($r['ip'], "decimal")]['code'] = 0;
$result[$Subnets->transform_address($r['ip'], "decimal")]['status'] = "Online";
// update alive time and mac address
@$Scan->ping_update_lastseen($result[$Subnets->transform_address($r['ip'], "decimal")]['id'], $r['mac']);
@$Scan->ping_update_lastseen($result[$Subnets->transform_address($r['ip'], "decimal")]['id'], null, $r['mac']);
}
}
}
......
......@@ -587,11 +587,15 @@ class Scan extends Common_functions {
* @param datetime $datetime
* @return void
*/
public function ping_update_lastseen ($id, $mac = null, $datetime = null) {
public function ping_update_lastseen ($id, $datetime = null, $mac = null) {
# set datetime
$datetime = is_null($datetime) ? date("Y-m-d H:i:s") : $datetime;
# execute
try { $this->Database->updateObject("ipaddresses", array("id"=>$id, "mac"=>$mac, "lastSeen"=>$datetime), "id"); }
$update_ipaddress = array("id"=>$id, "lastSeen"=>$datetime);
if (!is_null($mac)) {
$update_ipaddress["mac"] = $mac;
}
try { $this->Database->updateObject("ipaddresses", $update_ipaddress, "id"); }
catch (Exception $e) {
!$this->debugging ? : $this->Result->show("danger", $e->getMessage(), false);
# log
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment