Changeset 214 for trunk/system/netwatch_import.php
- Timestamp:
- May 11, 2009, 9:28:16 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/netwatch_import.php
r213 r214 34 34 { 35 35 $Online = 1; 36 $Values = array('Online' => $Online, 36 $Values = array('Online' => $Online, 'LastOnline' => 'NOW()'); 37 37 } else 38 38 { … … 45 45 { 46 46 $DbResult = $Database->select('NetworkInterface', 'Id', 'LocalIP = "'.$Properties['host'].'"'); 47 $DbRow = $DbResult->fetch_a rray();47 $DbRow = $DbResult->fetch_assoc(); 48 48 $HostId = $DbRow['Id']; 49 49 $DbResult2 = $Database->select('stat_hosts', '*', '(host_id="'.$HostId.'") AND (time = DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))'); … … 54 54 } 55 55 56 // Update device online state 57 $DbResult = $Database->select('NetworkDevice', 'Id', 'Used=1'); 58 while($Device = $DbResult->fetch_assoc()) 59 { 60 $DbResult2 = $Database->select('NetworkInterface', 'SUM(Online)', 'Device='.$Device['Id']); 61 $DbRow = $DbResult2->fetch_array(); 62 if($DbRow['SUM(Online)'] > 0) $Online = 1; else $Online = 0; 63 $Database->update('NetworkDevice', 'Id='.$Device['Id'], array('Online' => $Online)); 64 } 65 56 66 ?>
Note:
See TracChangeset
for help on using the changeset viewer.