Ignore:
Timestamp:
May 10, 2009, 12:30:09 PM (16 years ago)
Author:
george
Message:

Opraveno: Skripty pro generování nastavení směrovačů.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/system/generators/traffic_shaping_routerboard.php

    r208 r213  
    7575  $Commands[] = ' /queue tree add name='.$Member['Name'].'-in limit-at='.$SpeedOut.' max-limit='.$UserMaxSpeedOut.' parent=main-in queue=wireless-default';
    7676
    77   $DbResult2 = $Database->select('hosts', 'COUNT(*)', '(block = 0) AND (MAC != "") AND (user='.$Member['Id'].')');
    78   $Row = $DbResult2->fetch_array();
     77  $DbResult2 = $Database->select('NetworkDevice', 'COUNT(*)', 'Member='.$Member['Id']);
     78  $Row = $DbResult2->fetch_row();
    7979  $HostCount = $Row[0];
    8080  if($HostCount > 0)
     
    9191  while($Device = $DbResult2->fetch_assoc())
    9292  {
    93     $DbResult3 = $Database->select('NetworkInterface', '*', 'Device = '.$Device['Id']);
     93    $DbResult3 = $Database->select('NetworkInterface', '*', 'Device = '.$Device['Id'].' AND LocalIP != ""');
    9494    while($Interface = $DbResult3->fetch_assoc())
    9595    {
    96       $Name = $Device['Name'].'-'.$Interface['Name'];
     96      $Name = $Device['Name'];
     97      if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
    9798      $Name = RouterOSIdent($Name);
    9899      echo($Name.', ');
     
    123124 
    124125  $DbResult2 = $Database->select('NetworkSubnet', '*', 'Member='.$Member['Id']);
    125   while($Subnet = $DbResult2->fetch_array())
     126  while($Subnet = $DbResult2->fetch_assoc())
    126127  {
    127128    $Subnet['Name'] = RouterOSIdent('subnet-'.$Subnet['Name']);
     
    139140    if($Index > 50)
    140141    {
     142      //print_r($Commands);
    141143      $Commands = addslashes(implode(';', $Commands));
    142144      $Command = '/usr/bin/ssh -l '.$Config['MainRouter']['UserName'].' -i id_dsa '.$Config['MainRouter']['HostName'].' "'.$Commands.'"';
     
    150152    $Index++;
    151153  }
    152  
    153154  echo("\n");
    154155}
Note: See TracChangeset for help on using the changeset viewer.