"Fossies" - the Fresh Open Source Software Archive

Member "webbind_0.98/writezone.php" (5 Jan 2002, 4495 Bytes) of package /linux/misc/dns/old/WeBBind_0.98.tar:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?
    2 require("htmlcommon.php");
    3 require("global.php");
    4 require("locking.php");
    5 require("clrzonesess.php");
    6 
    7 $serverchoose = $servername[$idserver];
    8 
    9 // INSERIRE CONTROLLO CONGRUENZA MINIMA DATI
   10 
   11 
   12 if ( $serial != "" ) {
   13         $SERIAL = $serial ;
   14     }
   15 
   16 if ( $nameservernew != "" ) {
   17         $NSnew = trim ($nameservernew) ;
   18     }
   19 
   20 if ( $mailxvaluenew != "" && $mailxrecordnew != "" ) {
   21         $MXhostnew = $mailxhostnew ;
   22                 $MXvaluenew = $mailxvaluenew ;
   23                 $MXrecordnew = $mailxrecordnew ;
   24         }
   25 
   26 if ( $ahostnew != "" && $aipnew != "" ) {
   27                 $Ahostnew = $ahostnew ;
   28                 $Aipnew = $aipnew ;
   29         }
   30 
   31 if ( $cnamehostnew != "" && $cnamevaluenew != "" ) {
   32                 $CNAMEhostnew = $cnamehostnew ;
   33                 $CNAMEvaluenew = $cnamevaluenew ;
   34         }
   35 
   36 if ( $delegationzonenew != "" && $delegationnsnew != "" ) {
   37                 $DELEGATIONzonenew = $delegationzonenew ;
   38                 $DELEGATIONnsnew = $delegationnsnew ;
   39         }
   40 
   41 if ( $ptripnnew != "" && $ptrhostnnew != "" ) {
   42                 $PTRipnew = $ptripnnew ;
   43                 $PTRhostnew = $ptrhostnnew ;
   44         }
   45 
   46 
   47 $SUFFIXZONENAME = explode("/", $filelocation);
   48  end($SUFFIXZONENAME);
   49 $ZONENAME = ereg_replace("\.dns", "", current($SUFFIXZONENAME));
   50 $TIMESTAMP = "Last modification on  ".date("Y/m/d H:i:s")."  by user: $username" ;
   51 
   52 
   53 $zoneout .= ";\n";
   54 $zoneout .= ";\t$TIMESTAMP\n";
   55 $zoneout .= ";\n";
   56 $zoneout .= ";\tDatabase file ".current($SUFFIXZONENAME)." for $ZONENAME zone.\n";
   57 $zoneout .= ";\n";
   58 $zoneout .= ";\n";
   59 $zoneout .= "\$TTL 86400\n";
   60 $zoneout .= "@\t\tIN\tSOA $serverchoose. postmaster.$serverchoose. (\n";
   61 $zoneout .= "\t\t\t$oserial\t; serial number\n";
   62 $zoneout .= "\t\t\t$refresh\t\t; refresh\n";
   63 $zoneout .= "\t\t\t$retry\t\t; retry\n";
   64 $zoneout .= "\t\t\t$expire\t\t; expire\n";
   65 $zoneout .= "\t\t\t$ttl )\t\t; minimum TTL\n";
   66 $zoneout .= ";\n";
   67 $zoneout .= ";\n";
   68 $zoneout .= ";\tZone NS records\n";
   69 $zoneout .= ";\n";
   70 $zoneout .= ";\n";
   71   for ($i = 0; $i < (count ($nameserver)); $i++) {
   72     if ($nameserver[$i]) {
   73         $zoneout .= "@\t\tNS\t$nameserver[$i]\n";
   74     }
   75   }
   76   if ($NSnew) {
   77     $zoneout .= "@\t\tNS\t$NSnew\n";
   78   }
   79 $zoneout .= ";\n";
   80 $zoneout .= ";\n";
   81 $zoneout .= ";\tZone records\n";
   82 $zoneout .= ";\n";
   83 $zoneout .= ";\n";
   84     for ($i = 0; $i < (count ($mailxvalue)); $i++) {
   85     if ($mailxrecord[$i]) {
   86             $zoneout .= "$mailxhost[$i]\t\tMX\t$mailxvalue[$i]\t$mailxrecord[$i]\n";
   87     }
   88   }
   89   if ($MXvaluenew) {
   90     $zoneout .= "$MXhostnew\t\tMX\t$MXvaluenew\t$MXrecordnew\n";
   91   }
   92 $zoneout .= "\n";
   93 $zoneout .= "\n";
   94     for ($i = 0; $i < (count ($ahost)); $i++) {
   95     if ($aip[$i]) {
   96             $zoneout .= "$ahost[$i]\t\tA\t$aip[$i]\n";
   97     }
   98   }
   99   if ($Ahostnew) {
  100         $zoneout .= "$Ahostnew\t\tA\t$Aipnew\n";
  101   }
  102 $zoneout .= "\n";
  103 $zoneout .= "\n";
  104         for ($i = 0; $i < (count ($cnamehost)); $i++) {
  105         if ($cnamevalue[$i]) {
  106                 $zoneout .= "$cnamehost[$i]\t\tCNAME\t$cnamevalue[$i]\n";
  107         }
  108   }
  109   if ($CNAMEhostnew) {
  110         $zoneout .= "$CNAMEhostnew\t\tCNAME\t$CNAMEvaluenew\n";
  111   }
  112   for ($i = 0; $i < (count ($ptrhost)); $i++) {
  113         if ($ptrhost[$i]) {
  114                 $zoneout .= "$ptrip[$i]\t\tPTR\t$ptrhost[$i]\n";
  115             if ($ptrhostnew[$i]) { 
  116                     $zoneout .= "\t\tPTR\t$ptrhostnew[$i]\n";
  117             }
  118         }
  119   }
  120   if ($PTRipnew) {
  121         $zoneout .= "$PTRipnew\t\tPTR\t$PTRhostnew\n";
  122   }
  123 
  124 $zoneout .= ";\n";
  125 $zoneout .= ";\n";
  126 $zoneout .= ";\tDelegated sub-zone\n";
  127 $zoneout .= ";\n";
  128 $zoneout .= ";\n";
  129         for ($i = 0; $i < (count ($delegationzone)); $i++) {
  130         if ($delegationzone[$i]) {
  131                 $zoneout .= "$delegationzone[$i]\t\tNS\t$delegationns[$i]\n";
  132         }
  133   }
  134   if ($DELEGATIONzonenew) {
  135         $zoneout .= "$DELEGATIONzonenew\t\tNS\t$DELEGATIONnsnew\n";
  136   }
  137 $zoneout .= "\n";
  138 
  139 // print $zoneout;
  140 
  141 $fl=Filelock();
  142 if ( $fl ) {
  143 
  144     // SALVA UNA COPIA DI BACKUP E MODIFICA LA ZONA //
  145     if (!copy($filelocation, $filelocation.'.backup')) {
  146         HTMLHeader();
  147         Banner("Fail to backup zonefile for $SUFFIXZONENAME<BR><BR><A HREF=\"$phpbindurl\">Back To Search Page</A>",$user,$server);
  148         die();
  149     }
  150 
  151     $fp = fopen ("$filelocation", "w+");
  152     fwrite ($fp, $zoneout);
  153     fclose ($fp);
  154 
  155 fclose($fl);
  156 }
  157 
  158 // Need .rhosts in named home dir (SOLARIS) with client hostname and named as user
  159 
  160 exec ("$remexec $ipbe[$idserver] $subin[$idserver]/ndc reload $ZONENAME", $result);
  161 
  162 HTMLHeader();
  163 Banner("$result[0]<BR><BR><A HREF=\"$phpbindurl\">Back To Search Page</A>",$user,$server);
  164 
  165 ClrZoneSess($zonelock);
  166 
  167 ?>