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/generators/iptables.php

    r7 r37  
    1 <?
    2 include('global.php');
    3 include_once('../../html/is/db.php');
    4 DB_Init('localhost', 'root', '', 'is');
     1<?php
     2include_once('../../html/global.php');
    53
    64// Generate firewall rules
     
    119
    1210// Blocking according IP address
    13 DB_Select('users', '*', 'inet = 0');
    14 while($User = DB_Row())
     11$DbResult = $Database->select('users', '*', 'inet = 0');
     12while($User = $DbResult->fetch_array())
    1513{
    16   DB_Save();
    17   DB_Select('hosts', '*', "block<2 AND MAC!='' AND user=".$User['id']);
    18   while($Row = DB_Row())
     14  $DbResult2 = $Database->select('hosts', '*', "block<2 AND MAC!='' AND user=".$User['id']);
     15  while($Row = $DbResult2->fetch_array())
    1916  {
    2017    exec('iptables -t nat -A Block -s '.$Row['IP'].' -j Local');
    2118  }
    22   DB_Load();
    2319}
    24 DB_Select('users', '*', 'inet = 1');
    25 while($User = DB_Row())
     20$DbResult = $Database->select('users', '*', 'inet = 1');
     21while($User = $DbResult->fetch_array())
    2622{
    27   DB_Save();
    28   DB_Select('hosts','*',"block<2 AND MAC!='' AND vpn=1 AND user=".$User['id']);
    29   while($Row = DB_Row())
     23  $DbResult2 = $Database->select('hosts','*',"block<2 AND MAC!='' AND vpn=1 AND user=".$User['id']);
     24  while($Row = $DbResult2->fetch_array())
    3025  {
    3126    exec('iptables -t nat -A Block -s '.$Row['IP'].' -j Local');
    3227  }
    33   DB_Load();
    3428}
    3529
    3630// Blocking according MAC address
    37 DB_Select('users', '*');
    38 while($User = DB_Row())
     31$DbResult = $Database->select('users', '*');
     32while($User = $DbResult->fetch_array())
    3933{
    4034  //echo($User['fullname']."\n");
    41   DB_Save();
    42   DB_Select('hosts','*','block<2 AND MAC!="" AND user='.$User['id'].' ORDER BY id DESC');
    43   while($Row = DB_Row())
     35  $DbResult2 = $Database->select('hosts','*','block<2 AND MAC!="" AND user='.$User['id'].' ORDER BY id DESC');
     36  while($Row = $DbResult2->fetch_array())
    4437  {
    4538    //echo(' '.$Row['name']." ".$Row['MAC']." ");
     
    9285    //echo("\n");
    9386  }
    94   DB_Load();
    9587}
    9688
    9789// SMTP NAT port 25
    98 DB_Select('hosts', '*', 'name="MAIL"');
    99 $Row = DB_Row();
     90$DbResult = $Database->select('hosts', '*', 'name="MAIL"');
     91$Row = $DbResult->fetch_array();
    10092exec('iptables -t nat -A PreroutingDNAT -p tcp -m tcp --dport 25 -d 212.111.4.174 -j DROP'); 
    10193exec('iptables -t nat -A PreroutingDNAT -p tcp -m tcp --dport 25 -d '.$Row['external_ip'].' -j DNAT --to-destination '.$Row['IP']); 
     
    10496
    10597// Local network NAT
    106 DB_Select('hosts', '*', 'name="GATE"');
    107 $Row = DB_Row();
     98$DbResult = $Database->select('hosts', '*', 'name="GATE"');
     99$Row = $DbResult->fetch_array();
    108100exec('iptables -t nat -A POSTROUTING -s 192.168.0.0/255.255.0.0 -o eth1 -j SNAT --to-source '.$Row['external_ip']);
    109101//exec('iptables -t nat -A POSTROUTING -s 10.0.0.0/255.0.0.0 -o eth1 -j SNAT --to-source '.$Row['external_ip']);
Note: See TracChangeset for help on using the changeset viewer.