1
|
1 |
<?php |
|
2 |
session_start(); |
|
3 |
// +--------------------------------------------------------------------+ |
|
4 |
// | PowerAdmin | |
|
5 |
// +--------------------------------------------------------------------+ |
|
6 |
// | Copyright (c) 1997-2002 The PowerAdmin Team | |
|
7 |
// +--------------------------------------------------------------------+ |
|
8 |
// | This source file is subject to the license carried by the overal | |
|
9 |
// | program PowerAdmin as found on http://poweradmin.sf.net | |
|
10 |
// | The PowerAdmin program falls under the QPL License: | |
|
11 |
// | http://www.trolltech.com/developer/licensing/qpl.html | |
|
12 |
// +--------------------------------------------------------------------+ |
|
13 |
// | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl> | |
|
14 |
// | Sjeemz <sjeemz <AT> sjeemz <DOT> nl> | |
|
15 |
// +--------------------------------------------------------------------+ |
|
16 |
|
|
17 |
// |
|
18 |
// $Id: index.php,v 1.13 2003/05/10 20:20:05 azurazu Exp $ |
|
19 |
// |
|
20 |
|
6
|
21 |
require_once("inc/i18n.inc.php"); |
1
|
22 |
require_once("inc/toolkit.inc.php"); |
|
23 |
|
|
24 |
if ($_POST["submit"]) |
|
25 |
{ |
|
26 |
$domain = trim($_POST["domain"]); |
|
27 |
$owner = $_POST["owner"]; |
|
28 |
$webip = $_POST["webip"]; |
|
29 |
$mailip = $_POST["mailip"]; |
|
30 |
$empty = $_POST["empty"]; |
|
31 |
$dom_type = isset($_POST["dom_type"]) ? $_POST["dom_type"] : "NATIVE"; |
|
32 |
if(!$empty) |
|
33 |
{ |
|
34 |
$empty = 0; |
|
35 |
if(!eregi('in-addr.arpa', $domain) && (!is_valid_ip($webip) || !is_valid_ip($mailip)) ) |
|
36 |
{ |
|
37 |
$error = "Web or Mail ip is invalid!"; |
|
38 |
} |
|
39 |
} |
|
40 |
if (!$error) |
|
41 |
{ |
|
42 |
if (!is_valid_domain($domain)) |
|
43 |
{ |
|
44 |
$error = "Domain name is invalid!"; |
|
45 |
} |
|
46 |
elseif (domain_exists($domain)) |
|
47 |
{ |
|
48 |
$error = "Domain already exists!"; |
|
49 |
} |
|
50 |
//elseif (isset($mailip) && is_valid_ip( |
|
51 |
else |
|
52 |
{ |
|
53 |
add_domain($domain, $owner, $webip, $mailip, $empty, $dom_type); |
|
54 |
clean_page(); |
|
55 |
} |
|
56 |
} |
|
57 |
} |
|
58 |
|
|
59 |
if($_POST["passchange"]) |
|
60 |
{ |
|
61 |
if(strlen($_POST["newpass"]) < 4) |
|
62 |
{ |
|
63 |
error('Length of the pass should be at least 4'); |
|
64 |
} |
|
65 |
else |
|
66 |
{ |
|
67 |
change_user_pass($_POST["currentpass"], $_POST["newpass"], $_POST["newpass2"]); |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
include_once("inc/header.inc.php"); |
|
72 |
?> |
4
|
73 |
<H2><? echo _('DNS Admin'); ?></H2> |
1
|
74 |
|
|
75 |
<P FONT CLASS="nav"> |
|
76 |
<? |
|
77 |
if (level(10)) |
|
78 |
{ |
8
|
79 |
?><A HREF="users.php"><? echo _('User admin'); ?></A> <? |
1
|
80 |
} |
|
81 |
?> |
2
|
82 |
<A HREF="search.php"><? echo _('Search records'); ?></A> |
1
|
83 |
</P> |
|
84 |
|
|
85 |
<BR> |
2
|
86 |
<? echo _('Welcome'); ?>, <?= $_SESSION["name"] ?>. |
1
|
87 |
<BR> |
|
88 |
|
2
|
89 |
<? echo _('Your userlevel is'); ?>: <?= $_SESSION["level"] ?> (<?= leveldescription($_SESSION["level"]) ?>) |
1
|
90 |
<BR><BR> |
|
91 |
|
|
92 |
<? |
|
93 |
if ($error != "") |
|
94 |
{ |
2
|
95 |
?><H3><FONT COLOR="red"><? echo _('Error'); ?>: <?= $error ?></FONT></H3><? |
1
|
96 |
} |
|
97 |
?> |
|
98 |
|
2
|
99 |
<B><? echo _('Current domains in DNS (click to view or edit)'); ?>:</B> |
1
|
100 |
<BR> |
|
101 |
|
|
102 |
<? |
|
103 |
$doms = get_domains(0); |
|
104 |
$num_domains = count($doms); |
4
|
105 |
echo "<br /><small><b>" . _('Number of domains') . ": </b>".$num_domains."<br />"; |
1
|
106 |
|
|
107 |
if ($num_domains > ROWAMOUNT) { |
|
108 |
show_letters(LETTERSTART,$doms); |
|
109 |
echo "<br />"; |
|
110 |
} |
|
111 |
|
|
112 |
$doms = get_domains(0,LETTERSTART); |
|
113 |
show_pages(count($doms),ROWAMOUNT); |
|
114 |
|
|
115 |
?> |
|
116 |
|
|
117 |
<br /> |
|
118 |
<TABLE BORDER="0" CELLSPACING="4"> |
2
|
119 |
<TR STYLE="font-weight: Bold;"><TD CLASS="tdbg"> </TD><TD CLASS="tdbg"><? echo _('Name'); ?></TD><TD CLASS="tdbg"><? echo _('Records'); ?></TD><TD CLASS="tdbg"><? echo _('Owner'); ?></TD></TR> |
1
|
120 |
<? |
|
121 |
|
|
122 |
if ($num_domains < ROWAMOUNT) { |
|
123 |
$doms = get_domains(0,"all",ROWSTART,ROWAMOUNT); |
|
124 |
} else { |
|
125 |
$doms = get_domains(0,LETTERSTART,ROWSTART,ROWAMOUNT); |
|
126 |
} |
|
127 |
|
|
128 |
// If the user doesnt have any domains print a message saying so |
|
129 |
if ($doms < 0) |
|
130 |
{ |
2
|
131 |
?><TR><TD CLASS="tdbg"> </TD><TD CLASS="tdbg" COLSPAN="4"><b><? echo _('No domains in this listing, sorry.'); ?></b></FONT></TD></TR><? |
1
|
132 |
} |
|
133 |
|
|
134 |
// If he has domains, dump them (duh) |
|
135 |
else |
|
136 |
{ |
|
137 |
foreach ($doms as $c) |
|
138 |
{ |
|
139 |
?><TR><TD CLASS="tdbg"> |
|
140 |
<? if (level(5)) |
|
141 |
{ |
|
142 |
?> |
3
|
143 |
<A HREF="delete_domain.php?id=<?= $c["id"] ?>"><IMG SRC="images/delete.gif" ALT="[ <? echo _('Delete zone'); ?> ]" BORDER="0"></A><? |
1
|
144 |
} |
|
145 |
else |
|
146 |
{ |
|
147 |
print " "; |
|
148 |
} |
|
149 |
?> |
|
150 |
</TD><TD CLASS="tdbg"><A HREF="edit.php?id=<?= $c["id"] ?>"><?= $c["name"] ?></A></TD><TD CLASS="tdbg"><?= $c["numrec"] ?></TD><TD CLASS="tdbg"><?= get_owner_from_id($c["owner"]) ?></TD></TR><? |
|
151 |
print "\n"; |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
155 |
?> |
|
156 |
</TABLE> |
|
157 |
|
2
|
158 |
<small><? echo _('You only administer some records of domains marked with an (*).'); ?></small> |
1
|
159 |
|
|
160 |
<? |
|
161 |
if (level(5)) |
|
162 |
{ |
|
163 |
// Get some data. |
|
164 |
$server_types = array("MASTER", "SLAVE", "NATIVE"); |
|
165 |
$users = show_users(); |
|
166 |
?> |
|
167 |
<BR><BR> |
|
168 |
<FORM METHOD="post" ACTION="index.php"> |
2
|
169 |
<B><? echo _('Create new domain'); ?>:</B><BR> |
1
|
170 |
<TABLE BORDER="0" CELLSPACING="4"> |
2
|
171 |
<TR><TD CLASS="tdbg"><? echo _('Domain name'); ?>:</TD><TD WIDTH="510" CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="domain" VALUE="<? if ($error) print $_POST["domain"]; ?>"></TD></TR> |
|
172 |
<TR><TD CLASS="tdbg"><? echo _('Web IP'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="webip" VALUE="<? if ($error) print $_POST["webip"]; ?>"></TD></TR> |
|
173 |
<TR><TD CLASS="tdbg"><? echo _('Mail IP'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="mailip" VALUE="<? if ($error) print $_POST["mailip"]; ?>"></TD></TR> |
|
174 |
<TR><TD CLASS="tdbg"><? echo _('Owner'); ?>:</TD><TD CLASS="tdbg"> |
1
|
175 |
<SELECT NAME="owner"> |
|
176 |
<? |
|
177 |
foreach ($users as $u) |
|
178 |
{ |
|
179 |
?><OPTION VALUE="<?= $u['id'] ?>"><?= $u['fullname'] ?></OPTION><? |
|
180 |
} |
|
181 |
?> |
|
182 |
</SELECT> |
|
183 |
</TD></TR> |
|
184 |
<? |
|
185 |
if($MASTER_SLAVE_FUNCTIONS == true) |
|
186 |
{ |
|
187 |
?> |
2
|
188 |
<TR><TD CLASS="tdbg"><? echo _('Domain type'); ?>:</TD><TD CLASS="tdbg"> |
1
|
189 |
<SELECT NAME="dom_type"> |
|
190 |
<? |
|
191 |
foreach($server_types as $s) |
|
192 |
{ |
|
193 |
?><OPTION VALUE="<?=$s?>"><?=$s ?></OPTION><? |
|
194 |
} |
|
195 |
?> |
|
196 |
</SELECT> |
|
197 |
</TD></TR> |
|
198 |
<? } ?> |
2
|
199 |
<TR><TD CLASS="tdbg"><? echo _('Create zone without'); ?><BR><? echo _('applying records-template'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="checkbox" NAME="empty" VALUE="1"></TD></TR> |
|
200 |
<TR><TD CLASS="tdbg"> </TD><TD CLASS="tdbg"><INPUT TYPE="submit" CLASS="button" NAME="submit" VALUE="<? echo _('Add domain'); ?>"></TD></TR> |
1
|
201 |
</TABLE> |
|
202 |
</FORM> |
|
203 |
<? |
|
204 |
} |
|
205 |
?> |
|
206 |
|
|
207 |
<BR><BR> |
|
208 |
<FORM METHOD="post" ACTION="index.php"> |
3
|
209 |
<B><? echo _('Change password'); ?>:</B><BR> |
1
|
210 |
<TABLE BORDER="0" CELLSPACING="4"> |
2
|
211 |
<TR><TD CLASS="tdbg"><? echo _('Current password'); ?>:</TD><TD WIDTH="510" CLASS="tdbg"><INPUT TYPE="password" CLASS="input" NAME="currentpass" VALUE=""></TD></TR> |
3
|
212 |
<TR><TD CLASS="tdbg"><? echo _('New password'); ?>:</TD><TD WIDTH="510" CLASS="tdbg"><INPUT TYPE="password" CLASS="input" NAME="newpass" VALUE=""></TD></TR> |
|
213 |
<TR><TD CLASS="tdbg"><? echo _('New password'); ?>:</TD><TD WIDTH="510" CLASS="tdbg"><INPUT TYPE="password" CLASS="input" NAME="newpass2" VALUE=""></TD></TR> |
2
|
214 |
<TR><TD CLASS="tdbg"> </TD><TD CLASS="tdbg"><INPUT TYPE="submit" CLASS="button" NAME="passchange" VALUE="<? echo _('Change password'); ?>"></TD></TR> |
1
|
215 |
</TABLE> |
|
216 |
</FORM> |
|
217 |
<? |
|
218 |
include_once("inc/footer.inc.php"); |
|
219 |
?> |