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:
3 edited

Legend:

Unmodified
Added
Removed
  • system

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

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

    r1 r37  
    1 <?
    2 
     1<?php
     2
     3include('../../html/global.php');
     4$Database->select_db('statistic');
     5$Config['Web']['ShowError'] = 1;
    36echo("\nSledovac prenesenych dat\n");
    4 include('/a/html/is/db.php');
    5 DB_Init('localhost','root','','statistic');
    67$ERR = 0;
    78
    89function CpuUsage()
    910
    10   global $cpuIDLEprev, $cpuSYSTprev, $cpuUSERprev;
     11  global $cpuIDLEprev, $cpuSYSTprev, $cpuUSERprev, $Database;
     12
    1113  // get processor usage seconds for pct stats ###
    1214  $File = fopen('/proc/stat', 'r');
     
    8890function Resetuj()
    8991{
    90   global $ERR, $ID;
     92  global $ERR, $ID, $Database;
     93
    9194  echo("Error ".$ERR.". - restartuji pripojeni...");
    9295  if($ERR == 0)
    9396  {
    94     DB_Insert('failure', array('time' => 'NOW()', 'attempt' => 0));
    95     DB_Query('SELECT LAST_INSERT_ID() FROM failure LIMIT 0,1');
    96     $Row = DB_Row();   
     97    $Database->insert('failure', array('time' => 'NOW()', 'attempt' => 0));
     98    $DbResult = $Database->query('SELECT LAST_INSERT_ID() FROM failure LIMIT 0,1');
     99    $Row = $DbResult->fetch_array();   
    97100    $ID = $Row[0];
    98101  }
    99   else DB_Update('failure', 'id='.$ID,array('attempt' => $ERR));
     102  else $Database->update('failure', 'id='.$ID,array('attempt' => $ERR));
    100103  // echo($ID);
    101104//  if($ERR == 5) exec('killall -TERM pppd',$Output);
     
    123126  sleep(60);
    124127  $NetworkStat = GetNetworkStat();
    125   // zji¹tìní vytí¾ení procesoru
     128  // zjit��vyt�n�procesoru
    126129  $CPU = CpuUsage();
    127130  //$loadavg = fopen('/proc/loadavg','r');
     
    129132  //$CPU = $data[0];
    130133  //fclose($loadavg);
    131   // zji¹tìní poètu zapnutých poèítaèù
     134  // zjit��po�u zapnutch po�ta�
    132135 
    133   DB_Init('localhost','root','','is');
    134   DB_Query('SELECT COUNT(*) FROM hosts WHERE online=1 AND show_online=1');
    135   $Row = DB_Row();
     136  $Database->select_db('is');
     137  $DbResult = $Database->query('SELECT COUNT(*) FROM hosts WHERE online=1 AND show_online=1');
     138  $Row = $DbResult->fetch_array();
    136139  $OnlineHosts = $Row[0];
    137140
    138   DB_Query('SELECT COUNT(*) FROM users WHERE role=0');
    139   $Row = DB_Row();
     141  $DbResult = $Database->query('SELECT COUNT(*) FROM users WHERE role=0');
     142  $Row = $DbResult->fetch_array();
    140143  $MembersCount = $Row[0];
    141144
    142   DB_Init('localhost','root','','statistic');
     145  $Database->select_db('statistic');
    143146  $HDD = round(disk_free_space('/')/1024);
    144147  $HDD2 = round(disk_free_space('/mnt/sda1')/1024);
    145148 
    146   // Naètení teploty
     149  // Na�en�teploty
    147150  fseek($TemperatureFile,0);
    148151  $Temperature = fgets($TemperatureFile, 1000);
     
    153156  $Ping = Ping(); 
    154157
     158/*
    155159  file_get_contents('http://localhost/statistic/new/add.php?MeasureId=1&Value='.$NetworkStat['eth1']['down_avg']);
    156160  file_get_contents('http://localhost/statistic/new/add.php?MeasureId=2&Value='.$NetworkStat['eth1']['up_avg']);
     
    171175  file_get_contents('http://localhost/statistic/new/add.php?MeasureId=20&Value='.$NetworkStat['eth2']['down_avg']);
    172176  echo(file_get_contents('http://localhost/statistic/new/add.php?MeasureId=21&Value='.$NetworkStat['eth2']['up_avg']));
     177*/
    173178 
    174179//  echo('Down: '.$NetworkStat['eth1']['down_avg'].'  Up: '.$NetworkStat['eth1']['up_avg'].'  CPU: '.$CPU.'  HDD: '.$HDD.'  Hosts: '.$OnlineHosts.' Temperature: '.$Temperature.' GameServerCpu: '.$GameServerCpu.' WowPlayerCount2: '.$WowPlayerCount2.' Game-serverUsedMemory: '.$Centrala2UsedMemory.' Ping: '.$Ping);
     
    185190    'wlan2_down' => $NetworkStat['wlan2']['down_avg'], 'wlan2_up' => $NetworkStat['wlan2']['up_avg'],
    186191    'eth2_down' => $NetworkStat['eth2']['down_avg'], 'eth2_up' => $NetworkStat['eth2']['up_avg']);
    187   DB_Insert('traffic', $NewItem);
     192  $Database->insert('traffic', $NewItem);
    188193  //echo(serialize($NewItem)."\n");
    189194    //$LevelDivider = 10;
Note: See TracChangeset for help on using the changeset viewer.