add_zone_master.php
changeset 13 2ff220cfde13
child 22 0918664b9ff6
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         $webip = $_POST["webip"];
       
    16         $mailip = $_POST["mailip"];
       
    17         $empty = $_POST["empty"];
       
    18         $dom_type = isset($_POST["dom_type"]) ? $_POST["dom_type"] : "NATIVE";
       
    19         if(!$empty)
       
    20         {
       
    21                 $empty = 0;
       
    22                 if(!eregi('in-addr.arpa', $domain) && (!is_valid_ip($webip) || !is_valid_ip($mailip)) )
       
    23                 {
       
    24                         $error = "Web or Mail ip is invalid!";
       
    25                 }
       
    26         }
       
    27         if (!$error)
       
    28         {
       
    29                 if (!is_valid_domain($domain))
       
    30                 {
       
    31                         $error = "Zone name is invalid!";
       
    32                 }
       
    33                 elseif (domain_exists($domain))
       
    34                 {
       
    35                         $error = "Zone already exists!";
       
    36                 }
       
    37                 //elseif (isset($mailip) && is_valid_ip(
       
    38                 else
       
    39                 {
       
    40                         add_domain($domain, $owner, $webip, $mailip, $empty, $dom_type, '');
       
    41 			$success = _('Successfully added master zone.');
       
    42                 }
       
    43         }
       
    44 }
       
    45 
       
    46 include_once("inc/header.inc.php");
       
    47 
       
    48 	if ($error != "")
       
    49 	{
       
    50 	        ?><div class="error"><? echo _('Error'); ?>: <? echo $error; ?></div><?
       
    51 	}
       
    52 	elseif ($success != "")
       
    53 	{
       
    54 		?><div class="success"><? echo $success; ?></div><?
       
    55 	}
       
    56 
       
    57 	?>
       
    58 	<h2>Add master zone</h2>
       
    59 	<?
       
    60 
       
    61 	// Zone type set to master and native only, slave zones are created
       
    62 	// on a different page. 
       
    63         $zone_types = array("MASTER", "NATIVE");
       
    64         $users = show_users();
       
    65         ?>
       
    66         <form method="post" action="add_zone_master.php">
       
    67          <table>
       
    68           <tr>
       
    69            <td class="n"><? echo _('Zone name'); ?>:</td>
       
    70            <td class="n">
       
    71             <input type="text" class="input" name="domain" value="<? if ($error) print $_POST["domain"]; ?>">
       
    72            </td>
       
    73           </tr>
       
    74           <tr>
       
    75            <td class="n"><? echo _('Web IP'); ?>:</td>
       
    76            <td class="n">
       
    77             <input type="text" class="input" name="webip" value="<? if ($error) print $_POST["webip"]; ?>">
       
    78            </td>
       
    79           </tr>
       
    80           <tr>
       
    81            <td class="n"><? echo _('Mail IP'); ?>:</TD>
       
    82            <td class="n">
       
    83             <input type="text" class="input" name="mailip" value="<? if ($error) print $_POST["mailip"]; ?>">
       
    84            </td>
       
    85           </tr>
       
    86           <tr>
       
    87            <td class="n"><? echo _('Owner'); ?>:</td>
       
    88            <td class="n">
       
    89             <select name="owner">
       
    90         <?
       
    91         foreach ($users as $u)
       
    92         {
       
    93            ?><option value="<? echo $u['id'] ?>"><? echo $u['fullname'] ?></option><?
       
    94         }
       
    95         ?>
       
    96             </select>
       
    97            </td>
       
    98           </tr>
       
    99           <tr>
       
   100            <td class="n"><? echo _('Zone type'); ?>:</td>
       
   101            <td class="n">
       
   102             <select name="dom_type">
       
   103         <?
       
   104         foreach($zone_types as $s)
       
   105         {
       
   106            ?><option value="<? echo $s?>"><? echo $s ?></option><?
       
   107         }
       
   108         ?>
       
   109             </select>
       
   110            </td>
       
   111           </tr>
       
   112           <tr>
       
   113            <td class="n"><? echo _('Create zone without applying records-template'); ?>:</td>
       
   114 	   <td class="n"><input type="checkbox" name="empty" value="1"></td>
       
   115 	  </tr>
       
   116           <tr>
       
   117 	   <td class="n">&nbsp;</td>
       
   118 	   <td class="n">
       
   119 	    <input type="submit" class="button" name="submit" value="<? echo _('Add domain'); ?>">
       
   120 	   </td>
       
   121 	  </tr>
       
   122          </table>
       
   123         </form>
       
   124 <?
       
   125 
       
   126 include_once("inc/footer.inc.php");
       
   127 ?>