|
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 if($_POST["submit"]) |
|
11 { |
|
12 $master_ip = $_POST["master_ip"]; |
|
13 $ns_name = $_POST["ns_name"]; |
|
14 $account = $_POST["account"]; |
|
15 if (!$error) |
|
16 { |
|
17 if (!is_valid_ip($master_ip) && !is_valid_ip6($master_ip)) |
|
18 { |
|
19 $error = _('Given master IP address is not valid IPv4 or IPv6.'); |
|
20 } |
|
21 elseif (!is_valid_hostname($ns_name)) |
|
22 { |
|
23 $error = _('Given hostname for NS record not valid.'); |
|
24 } |
|
25 elseif (!validate_account($account)) |
|
26 { |
|
27 $error = _('Account name is not valid (may contain only alpha chars).'); |
|
28 } |
|
29 else |
|
30 { |
|
31 if(add_supermaster($master_ip, $ns_name, $account)) |
|
32 { |
|
33 $success = _('Successfully added supermaster.'); |
|
34 } |
|
35 } |
|
36 } |
|
37 } |
|
38 |
|
39 include_once("inc/header.inc.php"); |
|
40 |
|
41 if ($error != "") |
|
42 { |
|
43 ?><div class="error"><? echo _('Error'); ?>: <? echo $error; ?></div><? |
|
44 } |
|
45 elseif ($success != "") |
|
46 { |
|
47 ?><div class="success"><? echo $success; ?></div><? |
|
48 } |
|
49 |
|
50 ?> |
|
51 <h2><? echo _('Add supermaster'); ?></h2> |
|
52 <form method="post" action="add_supermaster.php"> |
|
53 <table> |
|
54 <tr> |
|
55 <td class="n"><? echo _('IP address of supermaster'); ?>:</td> |
|
56 <td class="n"> |
|
57 <input type="text" class="input" name="master_ip" value="<? if ($error) print $_POST["master_ip"]; ?>"> |
|
58 </td> |
|
59 </tr> |
|
60 <tr> |
|
61 <td class="n"><? echo _('Hostname in NS record'); ?>:</td> |
|
62 <td class="n"> |
|
63 <input type="text" class="input" name="ns_name" value="<? if ($error) print $_POST["ns_name"]; ?>"> |
|
64 </td> |
|
65 </tr> |
|
66 <tr> |
|
67 <td class="n"><? echo _('Account'); ?>:</td> |
|
68 <td class="n"> |
|
69 <input type="text" class="input" name="account" value="<? if ($error) print $_POST["account"]; ?>"> |
|
70 </td> |
|
71 </tr> |
|
72 <tr> |
|
73 <td class="n"> </td> |
|
74 <td class="n"> |
|
75 <input type="submit" class="button" name="submit" value="<? echo _('Add supermaster'); ?>"> |
|
76 </td> |
|
77 </tr> |
|
78 </table> |
|
79 </form> |
|
80 <? |
|
81 include_once("inc/footer.inc.php"); |
|
82 ?> |