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 |
|
|
30 |
if ($_POST["submit"]) |
|
31 |
{ |
|
32 |
$domain = trim($_POST["domain"]); |
|
33 |
$owner = $_POST["owner"]; |
|
34 |
$slave_master = $_POST["slave_master"]; |
|
35 |
$dom_type = "SLAVE"; |
|
36 |
if (!$error) |
|
37 |
{ |
|
38 |
if (!is_valid_domain($domain)) |
|
39 |
{ |
|
40 |
$error = "Zone name is invalid!"; |
|
41 |
} |
|
42 |
elseif (domain_exists($domain)) |
|
43 |
{ |
|
44 |
$error = "Zone already exists!"; |
|
45 |
} |
|
46 |
elseif (!is_valid_ip($slave_master)) |
|
47 |
{ |
|
48 |
$error = "IP of master NS for slave zone is not valid!"; |
|
49 |
} |
|
50 |
else |
|
51 |
{ |
|
52 |
if(add_domain($domain, $owner, $webip, $mailip, $empty, $dom_type, $slave_master)) |
|
53 |
{ |
|
54 |
$success = _('Successfully added slave zone.'); |
|
55 |
} |
|
56 |
} |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
include_once("inc/header.inc.php"); |
|
61 |
|
|
62 |
if ($error != "") |
|
63 |
{ |
|
64 |
?><div class="error"><? echo _('Error'); ?>: <? echo $error; ?></div><? |
|
65 |
} |
|
66 |
elseif ($success != "") |
|
67 |
{ |
|
68 |
?><div class="success"><? echo $success; ?></div><? |
|
69 |
} |
|
70 |
|
|
71 |
$users = show_users(); |
|
72 |
|
|
73 |
?> |
|
74 |
<h2><? echo _('Add slave zone'); ?></h2> |
|
75 |
<form method="post" action="add_zone_slave.php"> |
|
76 |
<table> |
|
77 |
<tr> |
|
78 |
<td class="n"><? echo _('Zone name'); ?>:</td> |
|
79 |
<td class="n"> |
|
80 |
<input type="text" class="input" name="domain" value="<? if ($error) print $_POST["domain"]; ?>"> |
|
81 |
</td> |
|
82 |
</tr> |
|
83 |
<tr> |
|
84 |
<td class="n"><? echo _('IP of master NS'); ?>:</td> |
|
85 |
<td class="n"> |
|
86 |
<input type="text" class="input" name="slave_master" value="<? if ($error) print $_POST["slave_master"]; ?>"> |
|
87 |
</td> |
|
88 |
</tr> |
|
89 |
<tr> |
|
90 |
<td class="n"><? echo _('Owner'); ?>:</td> |
|
91 |
<td class="n"> |
|
92 |
<select name="owner"> |
|
93 |
<? |
|
94 |
foreach ($users as $u) |
|
95 |
{ |
|
96 |
?><option value="<? echo $u['id'] ?>"><? echo $u['fullname'] ?></option><? |
|
97 |
} |
|
98 |
?> |
|
99 |
</select> |
|
100 |
</td> |
|
101 |
</tr> |
|
102 |
<tr> |
|
103 |
<td class="n"> </td> |
|
104 |
<td class="n"> |
|
105 |
<input type="submit" class="button" name="submit" value="<? echo _('Add domain'); ?>"> |
|
106 |
</td> |
|
107 |
</tr> |
|
108 |
</table> |
|
109 |
</form> |
|
110 |
<? |
|
111 |
include_once("inc/footer.inc.php"); |
|
112 |
?> |