- Timestamp:
- Dec 30, 2011, 9:19:03 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/import.php
r326 r335 17 17 } else 18 18 { 19 $Output = 'Vložte CSV data z SYLK exportu českéspořitelny';19 $Output = 'Vložte CSV data z SYLK exportu Poštovní spořitelny'; 20 20 $Output .= '<form action="?Operation=prepare" method="post">'; 21 21 $Output .= '<textarea name="Source" cols="80" rows="20"></textarea><br/>'; -
trunk/system/generators/netwatch.php
r317 r335 11 11 $Routerboard->Debug = true; 12 12 13 $DbResult3 = $Database->query('SELECT DISTINCT (`DHCP`) FROM `NetworkSubnet` '); // WHERE `Member` = 0');13 $DbResult3 = $Database->query('SELECT DISTINCT (`DHCP`) FROM `NetworkSubnet` WHERE `Configure` = 1'); // WHERE `Member` = 0'); 14 14 while($Router = $DbResult3->fetch_assoc()) 15 15 { … … 17 17 $Routerboard->HostName = $Router['DHCP']; 18 18 $Items = array(); 19 $DbResult = $Database->query('SELECT * FROM `NetworkSubnet` WHERE `DHCP`="'.$Router['DHCP'].'"');19 $DbResult = $Database->query('SELECT * FROM `NetworkSubnet` WHERE (`Configure` = 1) AND (`DHCP`="'.$Router['DHCP'].'")'); 20 20 while($Subnet = $DbResult->fetch_assoc()) 21 21 { -
trunk/system/generators/netwatch_import.php
r317 r335 12 12 $StartTime = time(); 13 13 14 $DbResult3 = $Database->query('SELECT * FROM `NetworkSubnet` WHERE `Member` IS NULL');14 $DbResult3 = $Database->query('SELECT DISTINCT (`DHCP`), * FROM `NetworkSubnet` WHERE (`Configure` = 1) AND (`Member` IS NULL)'); 15 15 //echo($DbResult3->num_rows); 16 16 while($Subnet = $DbResult3->fetch_assoc()) … … 24 24 foreach($List as $Properties) 25 25 { 26 $SubnetAddress = new NetworkAddressIPv4(); 27 $SubnetAddress->AddressFromString($Subnet['AddressRange']); 28 $SubnetAddress->Prefix = $Subnet['Mask']; 29 $Address = new NetworkAddressIPv4(); 30 $Address->AddressFromString($Properties['host']); 31 $Address->Prefix = 32; 32 if($SubnetAddress->Contain($Address)) 26 //echo($Properties['host'].', '); 27 if($Properties['status'] == 'up') 33 28 { 34 //echo($Properties['host'].', '); 35 if($Properties['status'] == 'up') 36 { 37 $Online = 1; 38 $Values = array('Online' => $Online, 'LastOnline' => 'NOW()'); 39 //echo($Properties['host']." up\n"); 40 } else 41 { 42 $Online = 0; 43 $Values = array('Online' => $Online); 44 //echo($Properties['host']." down\n"); 45 } 29 $Online = 1; 30 $Values = array('Online' => $Online, 'LastOnline' => 'NOW()'); 31 //echo($Properties['host']." up\n"); 32 } else 33 { 34 $Online = 0; 35 $Values = array('Online' => $Online); 36 //echo($Properties['host']." down\n"); 37 } 46 38 47 $DbResult = $Database->update('NetworkInterface', '`LocalIP` = "'.$Properties['host'].'"', $Values); 48 if($Online == 1) 49 { 50 $DbResult = $Database->select('NetworkInterface', 'Id', '`LocalIP` = "'.$Properties['host'].'"'); 51 $DbRow = $DbResult->fetch_assoc(); 52 $InterfaceId = $DbRow['Id']; 53 $DbResult2 = $Database->select('NetworkInterfaceStat', '*', '(`NetworkInterface`="'.$InterfaceId.'") AND (`Time` = DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))'); 54 if($DbResult2->num_rows == 0) $Database->query('REPLACE INTO `NetworkInterfaceStat` (`NetworkInterface`, `Time`) VALUES ("'.$InterfaceId.'", DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))'); 55 $Database->query('UPDATE `NetworkInterfaceStat` SET `PingCount` = `PingCount` + 1 WHERE (`NetworkInterface`="'.$InterfaceId.'") AND (`Time` = DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))'); 56 57 } 58 } 39 $DbResult = $Database->update('NetworkInterface', '`LocalIP` = "'.$Properties['host'].'"', $Values); 59 40 } 60 41 } … … 66 47 $DbResult2 = $Database->select('NetworkInterface', 'SUM(`Online`) AS `SumOnline`', '`Device`='.$Device['Id']); 67 48 $DbRow = $DbResult2->fetch_array(); 68 if($DbRow['SumOnline'] > 0) $Online = 1; else $Online = 0; 69 $Database->update('NetworkDevice', 'Id='.$Device['Id'], array('Online' => $Online)); 70 if($Online == 1) $Database->update('NetworkDevice', 'Id='.$Device['Id'], array('LastOnline' => 'NOW()')); 49 if($DbRow['SumOnline'] > 0) $Online = 1; 50 else $Online = 0; 51 $Values = array('Online' => $Online); 52 if($Online == 1) $Values['LastOnline'] = 'NOW()'; 53 $Database->update('NetworkDevice', 'Id='.$Device['Id'], $Values); 71 54 } 72 55 … … 79 62 } 80 63 64 // Update interface online statistics 65 $DbResult = $Database->select('NetworkInterface', 'Id', '`Online` = 1'); 66 while($Interface = $DbResult->fetch_assoc()) 67 { 68 $DbResult2 = $Database->select('NetworkInterfaceStat', '*', '(`NetworkInterface`="'.$Interface['Id'].'") AND (`Time` = DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))'); 69 if($DbResult2->num_rows == 0) $Database->query('REPLACE INTO `NetworkInterfaceStat` (`NetworkInterface`, `Time`, `PingCount`) VALUES ("'.$Interface['Id'].'", DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))', '1'); 70 $Database->query('UPDATE `NetworkInterfaceStat` SET `PingCount` = `PingCount` + 1 WHERE (`NetworkInterface`="'.$Interface['Id'].'") AND (`Time` = DATE_FORMAT(NOW(), "%Y-%m-%d %H:00:00"))'); 71 } 72 81 73 ?>
Note:
See TracChangeset
for help on using the changeset viewer.