Changeset 37 for system/bandwidth2.php
- Timestamp:
- Jan 31, 2008, 8:38:47 PM (17 years ago)
- Location:
- system
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
system
-
Property svn:ignore
set to
nohup.out
-
Property svn:ignore
set to
-
system/bandwidth2.php
r1 r37 1 <? 1 <?php 2 2 3 include_once('/a/html/is/db.php'); 4 DB_Init('localhost','root','','is'); 5 6 include_once('/a/sys/generators/global.php'); 3 include_once('../html/global.php'); 4 include_once('generators/global.php'); 7 5 8 6 function GetTrafficStatus() … … 108 106 // Preload db host list from database 109 107 $DbHosts = array(); 110 DB_Select('hosts','*');111 while($Row = DB_Row())108 $DbResult = $Database->select('hosts','*'); 109 while($Row = $DbResult->fetch_array()) 112 110 { 113 111 if(($Row['vpn'] == 1) and ($Row['external_ip'] == '')) $DbHosts[ToVpnIp($Row)] = $Row['name']; … … 125 123 Sleep($Period); 126 124 $Hosts = GetTrafficStatus(); 127 DB_Query('TRUNCATE TABLE known_hosts_ports');125 $Database->query('TRUNCATE TABLE known_hosts_ports'); 128 126 foreach($Hosts as $Index => $Item) 129 127 { … … 137 135 { 138 136 //DB_Query('UPDATE known_hosts SET traffic_total_up = traffic_total_up + '.$Item['up'].', traffic_total_down = traffic_total_down + '.$Item['down'].', traffic_avg_up='.$Item['up'].', traffic_avg_down='.$Item['down'].', hostname="'.$DbHosts[$Index].'" WHERE IP="'.$Index.'"'); 139 DB_Replace('known_hosts', array('IP' => $Index, 'hostname' => $DbHosts[$Index], 'traffic_avg_up' => $Item['up'], 'traffic_avg_down' => $Item['down'],137 $Database->replace('known_hosts', array('IP' => $Index, 'hostname' => $DbHosts[$Index], 'traffic_avg_up' => $Item['up'], 'traffic_avg_down' => $Item['down'], 140 138 'traffic_total_up' => $Item['total_up'], 'traffic_total_down' => $Item['total_down'])); 141 139 if(array_key_exists('ports', $Item)) … … 146 144 $Port['up'] = ($Port['up'] - $LastHosts[$Index]['ports'][$PortNumber]['up']) / $Period; 147 145 $Port['down'] = ($Port['down'] - $LastHosts[$Index]['ports'][$PortNumber]['down']) / $Period; 148 DB_Replace('known_hosts_ports', array('host' => $Index, 'port' => $PortNumber, 'up' => $Port['up'],146 $Database->replace('known_hosts_ports', array('host' => $Index, 'port' => $PortNumber, 'up' => $Port['up'], 149 147 'down' => $Port['down'], 'total_down' => $Port['total_down'], 'total_up' => $Port['total_up'])); 150 148 }
Note:
See TracChangeset
for help on using the changeset viewer.