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

    r211 r213  
    3434"\t\t\tMX\t10 ".$MailServer.".".$BaseDomain.".\n");
    3535
    36 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetwordInterface.Device WHERE NetworkInterface.LocalIP <> ""');
     36$DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.LocalIP <> ""');
    3737while($Interface = $DbResult->fetch_assoc())
    3838{
     
    4545
    4646// External records in internal server
    47 $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetwordInterface.Device WHERE NetworkInterface.ExternalIP <> ""');
     47$DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.ExternalIP <> ""');
    4848while($Interface = $DbResult->fetch_assoc())
    4949{
     
    117117    if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
    118118    $Name = strtolower($Name.'-ext');
    119     $IP = explode('.',$Interafce['ExternalIP']);
    120     fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($Name])."-ext.".$BaseDomain.".\n");
     119    $IP = explode('.',$Interface['ExternalIP']);
     120    fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($Name)."-ext.".$BaseDomain.".\n");
    121121  }
    122122  fclose($File);
     
    191191  "\t\t\tNS\t".$NameServers[1].".".$BaseDomain.".\n");
    192192
    193   $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetwordInterface.Device WHERE NetworkInterface.ExternalIP LIKE "'.$Network.'.%"');
     193  $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.ExternalIP LIKE "'.$Network.'.%"');
    194194  while($Interface = $DbResult->fetch_assoc())
    195195  {
     
    197197    if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
    198198    $Name = strtolower($Name);
    199     if(strlen($Name) < 8) $Name .= "\t";
     199    //if(strlen($Name) < 8) $Name .= "\t";
    200200    $IP = explode('.', $Interface['ExternalIP']);
    201     fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($Interface['Name']).".".$BaseDomain.".\n");
     201    fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($Name).".".$BaseDomain.".\n");
    202202  }
    203203
     
    254254  fputs($File, $Name."\tIN\tA\t".$Interface['CZFreeIP']."\n");
    255255  fputs($File2, $Name."\tIN\tA\t".$Interface['LocalIP']."\n");
     256  $Name = $Interface['DeviceName'];
     257  if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
     258  $Name = strtolower($Name);
    256259  $Name .= '-czfree';
    257260  fputs($File2, $Name."\tIN\tA\t".$Interface['CZFreeIP']."\n");
    258261}
    259262
    260 $DbResult = $Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias` JOIN `hosts`  ON NetworkDomainAlias.Target LIKE hosts.name AND hosts.czfree_ip != ""');
     263$DbResult = $Database->query('SELECT NetworkDomainAlias.* FROM `NetworkDomainAlias`');
     264// JOIN `hosts`  ON NetworkDomainAlias.Target LIKE hosts.name AND hosts.czfree_ip != ""');
    261265while($Alias = $DbResult->fetch_assoc())
    262266{
     
    303307  fputs($File2, $Header);
    304308
    305   $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetwordInterface.Device WHERE NetworkInterface.CZFreeIP LIKE "'.$Network.'.%"');
     309  $DbResult = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE NetworkInterface.CZFreeIP LIKE "'.$Network.'.%"');
    306310  while($Interface = $DbResult->fetch_assoc())
    307311  {
     
    309313    if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
    310314    $Name = strtolower($Name);
     315    $Name2 = $Name;
    311316    if(strlen($Name) < 8) $Name .= "\t";
    312317    $IP = explode('.', $Interface['CZFreeIP']);
    313     fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($Interface['Name']).".".$Domain.".\n");
    314     fputs($File2, $IP[3]."\tIN\tPTR\t".strtolower($Interface['Name'].'-czfree').".".$Domain.".\n");
     318    fputs($File, $IP[3]."\tIN\tPTR\t".strtolower($Name2).".".$Domain.".\n");
     319    fputs($File2, $IP[3]."\tIN\tPTR\t".strtolower($Name2.'-czfree').".".$Domain.".\n");
    315320  }
    316321
Note: See TracChangeset for help on using the changeset viewer.