13
|
1 |
<?php |
47
|
2 |
|
|
3 |
/* PowerAdmin, a friendly web-based admin tool for PowerDNS. |
|
4 |
* See <https://rejo.zenger.nl/poweradmin> for more details. |
|
5 |
* |
|
6 |
* Copyright 2007, 2008 Rejo Zenger <rejo@zenger.nl> |
|
7 |
* |
|
8 |
* This program is free software: you can redistribute it and/or modify |
|
9 |
* it under the terms of the GNU General Public License as published by |
|
10 |
* the Free Software Foundation, either version 3 of the License, or |
|
11 |
* (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
20 |
*/ |
|
21 |
|
13
|
22 |
require_once("inc/toolkit.inc.php"); |
|
23 |
|
|
24 |
if (!level(5)) |
|
25 |
{ |
|
26 |
error(ERR_LEVEL_5); |
|
27 |
} |
|
28 |
|
|
29 |
if($_POST["submit"]) |
|
30 |
{ |
|
31 |
$master_ip = $_POST["master_ip"]; |
|
32 |
$ns_name = $_POST["ns_name"]; |
|
33 |
$account = $_POST["account"]; |
|
34 |
if (!$error) |
|
35 |
{ |
|
36 |
if (!is_valid_ip($master_ip) && !is_valid_ip6($master_ip)) |
|
37 |
{ |
|
38 |
$error = _('Given master IP address is not valid IPv4 or IPv6.'); |
|
39 |
} |
|
40 |
elseif (!is_valid_hostname($ns_name)) |
|
41 |
{ |
|
42 |
$error = _('Given hostname for NS record not valid.'); |
|
43 |
} |
|
44 |
elseif (!validate_account($account)) |
|
45 |
{ |
|
46 |
$error = _('Account name is not valid (may contain only alpha chars).'); |
|
47 |
} |
|
48 |
else |
|
49 |
{ |
|
50 |
if(add_supermaster($master_ip, $ns_name, $account)) |
|
51 |
{ |
|
52 |
$success = _('Successfully added supermaster.'); |
|
53 |
} |
|
54 |
} |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
include_once("inc/header.inc.php"); |
|
59 |
|
|
60 |
if ($error != "") |
|
61 |
{ |
|
62 |
?><div class="error"><? echo _('Error'); ?>: <? echo $error; ?></div><? |
|
63 |
} |
|
64 |
elseif ($success != "") |
|
65 |
{ |
|
66 |
?><div class="success"><? echo $success; ?></div><? |
|
67 |
} |
|
68 |
|
|
69 |
?> |
|
70 |
<h2><? echo _('Add supermaster'); ?></h2> |
|
71 |
<form method="post" action="add_supermaster.php"> |
|
72 |
<table> |
|
73 |
<tr> |
|
74 |
<td class="n"><? echo _('IP address of supermaster'); ?>:</td> |
|
75 |
<td class="n"> |
|
76 |
<input type="text" class="input" name="master_ip" value="<? if ($error) print $_POST["master_ip"]; ?>"> |
|
77 |
</td> |
|
78 |
</tr> |
|
79 |
<tr> |
|
80 |
<td class="n"><? echo _('Hostname in NS record'); ?>:</td> |
|
81 |
<td class="n"> |
|
82 |
<input type="text" class="input" name="ns_name" value="<? if ($error) print $_POST["ns_name"]; ?>"> |
|
83 |
</td> |
|
84 |
</tr> |
|
85 |
<tr> |
|
86 |
<td class="n"><? echo _('Account'); ?>:</td> |
|
87 |
<td class="n"> |
|
88 |
<input type="text" class="input" name="account" value="<? if ($error) print $_POST["account"]; ?>"> |
|
89 |
</td> |
|
90 |
</tr> |
|
91 |
<tr> |
|
92 |
<td class="n"> </td> |
|
93 |
<td class="n"> |
|
94 |
<input type="submit" class="button" name="submit" value="<? echo _('Add supermaster'); ?>"> |
|
95 |
</td> |
|
96 |
</tr> |
|
97 |
</table> |
|
98 |
</form> |
|
99 |
<? |
|
100 |
include_once("inc/footer.inc.php"); |
|
101 |
?> |