"Fossies" - the Fresh Open Source Software Archive

Member "webbind_0.98/parser.php" (5 Jan 2002, 3521 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 
    3 function ParseZone($user,$idserver,$dnsfile,$readonly) {
    4 
    5  $fp = fopen ("$dnsfile", "r");
    6 
    7  while (!feof ($fp)) {
    8         $buffer = fgets($fp, 4096);
    9 
   10         if ( (substr ($buffer, 0, 1) != ";") && (stristr ($buffer, "serial number")) ) {
   11                 $exprow = explode(";", $buffer);
   12                 $RECORD_SERIAL = trim($exprow[0]);
   13 
   14         } elseif ( (substr ($buffer, 0, 1) != ";") && (substr ($buffer, 0, 1) == chr(32) || substr ($buffer, 0, 1) == chr(9)  || substr ($buffer, 0, 1) == "@" ) && (ereg("NS", $buffer)) ) {
   15                 $exprow = explode("NS", $buffer);
   16                 $RECORD_NS[] = trim(end($exprow));
   17 
   18         } elseif ( (substr ($buffer, 0, 1) != ";") && (substr ($buffer, 0, 1) != "@") && (substr ($buffer, 0, 1) != chr(9)) && (ereg("(".chr(32).")(NS{1})|(".chr(9).")(NS{1})", $buffer)) ) {
   19                 $exprow = split("[\"".chr(32)."\"\"".chr(9)."\"]", $buffer);
   20                 $RECORD_DELEGATION[] .= (trim($exprow[0])." ".trim(end($exprow)));
   21 
   22         } elseif ( (substr ($buffer, 0, 1) != ";") && (ereg("MX", $buffer)) ) {
   23                 $exprow = explode("MX", $buffer);
   24                 $RECORD_MX[] = trim($exprow[0])." ".trim($exprow[1]);
   25 
   26         } elseif ( (substr ($buffer, 0, 1) != ";") && (ereg("(".chr(32).")(A{1})|(".chr(9).")(A{1})", $buffer)) ) {
   27                 $exprow = split("[\"".chr(32)."\"\"".chr(9)."\"]", $buffer);
   28                 $RECORD_A[] = (trim($exprow[0])." ".trim(end($exprow)));
   29 
   30         } elseif ( (substr ($buffer, 0, 1) != ";") && (ereg("CNAME", $buffer)) ) {
   31                 $exprow = explode("CNAME", $buffer);
   32                 $RECORD_CNAME[] = (trim($exprow[0])." ".trim($exprow[1]));
   33 
   34         } elseif ( (substr ($buffer, 0, 1) != ";") && (ereg("(".chr(32).")(PTR{1})|(".chr(9).")(PTR{1})", $buffer)) ) {
   35                 $exprow = split("[\"".chr(32)."\"\"".chr(9)."\"]", $buffer);
   36                 $RECORD_PTR[] = (trim($exprow[0])." ".trim(end($exprow)));
   37 
   38         } else {
   39                 if ( (substr ($buffer, 0, 1) != ";") || (ereg("user", $buffer)) ) { $otherinfo .= "$buffer<BR>"; }
   40 
   41         }
   42  }
   43 
   44  fclose ($fp);
   45 
   46 ModifyZone($RECORD_SERIAL,$RECORD_NS,$RECORD_DELEGATION,$RECORD_MX,$RECORD_A,$RECORD_CNAME,$RECORD_PTR,$otherinfo,$idserver,$dnsfile,$readonly,$user) ;
   47 
   48 /*
   49         print "<h4>";
   50         print ("Serial: ".$RECORD_SERIAL."<BR>");
   51         print ("NameServer01: ".($RECORD_NS[0]."<BR>"));
   52         print ("NameServer02: ".($RECORD_NS[1]."<BR>"));
   53         print ("Glue Record: ".($RECORD_DELEGATION."<BR>"));
   54 
   55         print ("MX Record01: ".($RECORD_MX[0]."<BR>"));
   56         print ("MX Record02: ".($RECORD_MX[1]."<BR>"));
   57         print ("MX Record02: ".($RECORD_MX[2]."<BR>"));
   58         print ("MX Record02: ".($RECORD_MX[3]."<BR>"));
   59         print ("MX Record02: ".($RECORD_MX[4]."<BR>"));
   60         print ("MX Record02: ".($RECORD_MX[5]."<BR>"));
   61 
   62 
   63 $distvalue = split("(   +)|( +)",$RECORD_MX[4]);
   64 print $distvalue[0];
   65 print "<BR>";
   66 print $distvalue[1];
   67 print "<BR>";
   68 print $distvalue[2];
   69 
   70 
   71         print ("Record A01: ".($RECORD_A[0]."<BR>"));
   72         print ("Record A01: ".($RECORD_A[1]."<BR>"));
   73         print ("Record A01: ".($RECORD_A[2]."<BR>"));
   74         print ("Record CNAME01: ".($RECORD_CNAME[0]."<BR>"));
   75         print ("Record CNAME02: ".($RECORD_CNAME[1]."<BR>"));
   76         print ($dnsfile."<BR>");
   77         print ("Record PTR01: ".($RECORD_PTR[0]."<BR>"));
   78         print ("Record PTR01: ".($RECORD_PTR[1]."<BR>"));
   79         print ("Record PTR01: ".($RECORD_PTR[2]."<BR>"));
   80         print ($otherinfo);
   81 
   82 */
   83 
   84 }
   85 
   86 ?>