Changeset 37 for system/bandwidth2.php


Ignore:
Timestamp:
Jan 31, 2008, 8:38:47 PM (17 years ago)
Author:
george
Message:

Upraveno: Přepsán přístup k databázi přes třídu mysqli v systémové složce.
Odstraněno: Staré verze souborů a staré nepoužité soubory.

Location:
system
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • system

    • Property svn:ignore set to
      nohup.out
  • system/bandwidth2.php

    r1 r37  
    1 <?
     1<?php
    22
    3 include_once('/a/html/is/db.php');
    4 DB_Init('localhost','root','','is');
    5 
    6 include_once('/a/sys/generators/global.php');
     3include_once('../html/global.php');
     4include_once('generators/global.php');
    75
    86function GetTrafficStatus()
     
    108106// Preload db host list from database
    109107$DbHosts = array();
    110 DB_Select('hosts','*');
    111 while($Row = DB_Row())
     108$DbResult = $Database->select('hosts','*');
     109while($Row = $DbResult->fetch_array())
    112110{
    113111  if(($Row['vpn'] == 1) and ($Row['external_ip'] == '')) $DbHosts[ToVpnIp($Row)] = $Row['name'];
     
    125123  Sleep($Period);
    126124  $Hosts = GetTrafficStatus();
    127   DB_Query('TRUNCATE TABLE known_hosts_ports');
     125  $Database->query('TRUNCATE TABLE known_hosts_ports');
    128126  foreach($Hosts as $Index => $Item)
    129127  {
     
    137135    {
    138136      //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'],
    140138        'traffic_total_up' => $Item['total_up'], 'traffic_total_down' => $Item['total_down']));
    141139      if(array_key_exists('ports', $Item))
     
    146144        $Port['up'] = ($Port['up'] - $LastHosts[$Index]['ports'][$PortNumber]['up']) / $Period;
    147145        $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'],
    149147          'down' => $Port['down'], 'total_down' => $Port['total_down'], 'total_up' => $Port['total_up']));
    150148      }
Note: See TracChangeset for help on using the changeset viewer.