add_zone_slave.php
changeset 13 2ff220cfde13
child 47 ae140472d97c
equal deleted inserted replaced
12:7be4525290cc 13:2ff220cfde13
       
     1 <?php
       
     2 require_once("inc/i18n.inc.php");
       
     3 require_once("inc/toolkit.inc.php");
       
     4 
       
     5 if (!level(5))
       
     6 {
       
     7         error(ERR_LEVEL_5);
       
     8 
       
     9 }
       
    10 
       
    11 if ($_POST["submit"])
       
    12 {
       
    13      $domain = trim($_POST["domain"]);
       
    14      $owner = $_POST["owner"];
       
    15      $slave_master = $_POST["slave_master"];
       
    16      $dom_type = "SLAVE";
       
    17      if (!$error)
       
    18      {
       
    19              if (!is_valid_domain($domain))
       
    20              {
       
    21                      $error = "Zone name is invalid!";
       
    22              }
       
    23              elseif (domain_exists($domain))
       
    24              {
       
    25                      $error = "Zone already exists!";
       
    26              }
       
    27              elseif (!is_valid_ip($slave_master))
       
    28              {
       
    29                      $error = "IP of master NS for slave zone is not valid!";
       
    30              }
       
    31              else
       
    32              {
       
    33                      if(add_domain($domain, $owner, $webip, $mailip, $empty, $dom_type, $slave_master))
       
    34 		     {
       
    35                                 $success = _('Successfully added slave zone.');
       
    36 		     }
       
    37              }
       
    38      }
       
    39 }
       
    40 
       
    41 include_once("inc/header.inc.php");
       
    42 
       
    43 	if ($error != "")
       
    44 	{
       
    45 	        ?><div class="error"><? echo _('Error'); ?>: <? echo $error; ?></div><?
       
    46 	}
       
    47 	elseif ($success != "")
       
    48 	{
       
    49 		?><div class="success"><? echo $success; ?></div><?
       
    50 	}
       
    51 	
       
    52 	$users = show_users();
       
    53 	
       
    54 	?>
       
    55 	    <h2><? echo _('Add slave zone'); ?></h2>
       
    56 	    <form method="post" action="add_zone_slave.php">
       
    57 	     <table>
       
    58 	      <tr>
       
    59 	       <td class="n"><? echo _('Zone name'); ?>:</td>
       
    60 	       <td class="n">
       
    61 	        <input type="text" class="input" name="domain" value="<? if ($error) print $_POST["domain"]; ?>">
       
    62 	       </td>
       
    63 	      </tr>
       
    64 	      <tr>
       
    65 	       <td class="n"><? echo _('IP of master NS'); ?>:</td>
       
    66 	       <td class="n">
       
    67 	        <input type="text" class="input" name="slave_master" value="<? if ($error) print $_POST["slave_master"]; ?>">
       
    68 	       </td>
       
    69 	      </tr>
       
    70 	      <tr>
       
    71 	       <td class="n"><? echo _('Owner'); ?>:</td>
       
    72 	       <td class="n">
       
    73 	        <select name="owner">
       
    74 	         <? 
       
    75 	         foreach ($users as $u)
       
    76 	         {
       
    77 	           ?><option value="<? echo $u['id'] ?>"><? echo $u['fullname'] ?></option><?
       
    78 	         } 
       
    79 	        ?>
       
    80 	        </select>
       
    81 	       </td>
       
    82 	      </tr>
       
    83 	      <tr>
       
    84 	       <td class="n">&nbsp;</td>
       
    85 	       <td class="n">
       
    86 	        <input type="submit" class="button" name="submit" value="<? echo _('Add domain'); ?>">
       
    87 	       </td>
       
    88 	      </tr>
       
    89 	     </table>
       
    90 	    </form>
       
    91 <?
       
    92 include_once("inc/footer.inc.php");
       
    93 ?>