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/known_mac.php

    r1 r37  
    1 <?
    2 include_once('/a/html/is/db.php');
    3 DB_Init('localhost','root','','statistic');
     1<?php
     2include_once('../html/global.php');
     3$Database->select_db('statistic');
    44
    55while(1)
    66{
    7   DB_Delete('ip_conntrack', '1');
     7  $Database->delete('ip_conntrack', '1');
    88  $File = fopen('/proc/net/arp', 'r');
    99  fgets($File);  // Title row
     
    2020      if($Mac != '00:00:00:00:00:00')
    2121      {
    22         DB_Select('known_mac', '*', 'ip="'.$Ip.'" AND mac="'.$Mac.'" AND interface="'.$Interface.'"');
    23         if(DB_NumRows() == 0) DB_Insert('known_mac', array('ip' => $Ip, 'mac' => $Mac, 'interface' => $Interface, 'first_time' => 'NOW()', 'last_time' => 'NOW()'));
    24           else DB_Update('known_mac', 'ip="'.$Ip.'" AND mac="'.$Mac.'" AND interface="'.$Interface.'"', array('last_time' => 'NOW()'));
     22        $DbResult = $Database->select('known_mac', '*', 'ip="'.$Ip.'" AND mac="'.$Mac.'" AND interface="'.$Interface.'"');
     23        if($DbResult->num_rows == 0) $Database->insert('known_mac', array('ip' => $Ip, 'mac' => $Mac, 'interface' => $Interface, 'first_time' => 'NOW()', 'last_time' => 'NOW()'));
     24          else $Database->update('known_mac', 'ip="'.$Ip.'" AND mac="'.$Mac.'" AND interface="'.$Interface.'"', array('last_time' => 'NOW()'));
    2525      }
    2626    } 
     
    2828  }
    2929  fclose($File);
    30   DB_Query('OPTIMIZE TABLE known_mac');
     30  $Database->query('OPTIMIZE TABLE known_mac');
    3131  Sleep(50);  // ARP cache timeout = 60 seconds
    3232}
Note: See TracChangeset for help on using the changeset viewer.