|
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 |
|
21 require_once("inc/toolkit.inc.php"); |
|
22 |
|
23 /* |
|
24 // Checks if the user migrated his database, can be deprecated in the future |
|
25 function check_updated() |
|
26 { |
|
27 global $db; |
|
28 $checkzone = $db->query("select * from zones"); |
|
29 $zonetables = $checkzone->tableInfo(); |
|
30 //var_dump($zonetables[1]); |
|
31 if(strcmp($zonetables[1]["name"], "name") == 0) |
|
32 { |
|
33 include_once("inc/header.inc.php"); |
|
34 error("You have to migrate your database first! |
|
35 |
|
36 The reason for this migration is that PowerAdmin wasnt supporting the gmysql backend yet. Now it fully does we have to support it aswell. |
|
37 The gmysql users another table and other fields though, therefore we had to change the layout of the zones table. In this version thats fully done, but before this we have to migrate it. |
|
38 |
|
39 Please be sure you have a working backup of your data! |
|
40 we assume it all works but cant guarantuee it for 100% because we dont have |
|
41 too many betatesters.<BR> |
|
42 |
|
43 Do the following to migrate: |
|
44 - rename the file migrator.php-pa in your webdir to migrator.php. |
|
45 - Go <A HREF='migrator.php'>here</A> to migrate it. |
|
46 |
|
47 It is recommended to synchronize your database aswell after the update"); |
|
48 die(); |
|
49 } |
|
50 } |
|
51 |
|
52 // Call above function |
|
53 check_updated(); |
|
54 */ |
|
55 |
|
56 if ($_POST["submit"]) |
|
57 { |
|
58 $domain = trim($_POST["domain"]); |
|
59 $owner = $_POST["owner"]; |
|
60 $webip = $_POST["webip"]; |
|
61 $mailip = $_POST["mailip"]; |
|
62 $empty = $_POST["empty"]; |
|
63 $dom_type = isset($_POST["dom_type"]) ? $_POST["dom_type"] : "NATIVE"; |
|
64 if(!$empty) |
|
65 { |
|
66 $empty = 0; |
|
67 if(!eregi('in-addr.arpa', $domain) && (!is_valid_ip($webip) || !is_valid_ip($mailip)) ) |
|
68 { |
|
69 $error = "Web or Mail ip is invalid!"; |
|
70 } |
|
71 } |
|
72 if (!$error) |
|
73 { |
|
74 if (!is_valid_domain($domain)) |
|
75 { |
|
76 $error = "Domain name is invalid!"; |
|
77 } |
|
78 elseif (domain_exists($domain)) |
|
79 { |
|
80 $error = "Domain already exists!"; |
|
81 } |
|
82 //elseif (isset($mailip) && is_valid_ip( |
|
83 else |
|
84 { |
|
85 add_domain($domain, $owner, $webip, $mailip, $empty, $dom_type); |
|
86 clean_page(); |
|
87 } |
|
88 } |
|
89 } |
|
90 |
|
91 if($_POST["passchange"]) |
|
92 { |
|
93 if(strlen($_POST["newpass"]) < 4) |
|
94 { |
|
95 error('Length of the pass should be at least 4'); |
|
96 } |
|
97 else |
|
98 { |
|
99 change_user_pass($_POST["currentpass"], $_POST["newpass"], $_POST["newpass2"]); |
|
100 } |
|
101 } |
|
102 |
|
103 include_once("inc/header.inc.php"); |
|
104 ?> |
|
105 <H2>DNS Admin</H2> |
|
106 |
|
107 <P FONT CLASS="nav"> |
|
108 <? |
|
109 if (level(10)) |
|
110 { |
|
111 ?><A HREF="users.php">User Admin</A> <A HREF="seq_update.php">Synchronize Database</A><? |
|
112 } |
|
113 ?> |
|
114 <A HREF="search.php">Search records</A> |
|
115 </P> |
|
116 |
|
117 <BR> |
|
118 Welcome, <?= $_SESSION["name"] ?>. |
|
119 <BR> |
|
120 |
|
121 Your userlevel is: <?= $_SESSION["level"] ?> (<?= leveldescription($_SESSION["level"]) ?>) |
|
122 <BR><BR> |
|
123 |
|
124 <? |
|
125 if ($error != "") |
|
126 { |
|
127 ?><H3><FONT COLOR="red">Error: <?= $error ?></FONT></H3><? |
|
128 } |
|
129 ?> |
|
130 |
|
131 <B>Current domains in DNS (click to view or edit):</B> |
|
132 <BR> |
|
133 |
|
134 <? |
|
135 $doms = get_domains(0); |
|
136 $num_domains = count($doms); |
|
137 echo "<br /><small><b>Number of domains: </b>".$num_domains."<br />"; |
|
138 |
|
139 if ($num_domains > ROWAMOUNT) { |
|
140 show_letters(LETTERSTART,$doms); |
|
141 echo "<br />"; |
|
142 } |
|
143 |
|
144 $doms = get_domains(0,LETTERSTART); |
|
145 show_pages(count($doms),ROWAMOUNT); |
|
146 |
|
147 ?> |
|
148 |
|
149 <br /> |
|
150 <TABLE BORDER="0" CELLSPACING="4"> |
|
151 <TR STYLE="font-weight: Bold;"><TD CLASS="tdbg"> </TD><TD CLASS="tdbg">Name</TD><TD CLASS="tdbg">Records</TD><TD CLASS="tdbg">Owner</TD></TR> |
|
152 <? |
|
153 |
|
154 if ($num_domains < ROWAMOUNT) { |
|
155 $doms = get_domains(0,"all",ROWSTART,ROWAMOUNT); |
|
156 } else { |
|
157 $doms = get_domains(0,LETTERSTART,ROWSTART,ROWAMOUNT); |
|
158 } |
|
159 |
|
160 // If the user doesnt have any domains print a message saying so |
|
161 if ($doms < 0) |
|
162 { |
|
163 ?><TR><TD CLASS="tdbg"> </TD><TD CLASS="tdbg" COLSPAN="4"><b>No domains in this listing, sorry.</b></FONT></TD></TR><? |
|
164 } |
|
165 |
|
166 // If he has domains, dump them (duh) |
|
167 else |
|
168 { |
|
169 foreach ($doms as $c) |
|
170 { |
|
171 ?><TR><TD CLASS="tdbg"> |
|
172 <? if (level(5)) |
|
173 { |
|
174 ?> |
|
175 <A HREF="delete_domain.php?id=<?= $c["id"] ?>"><IMG SRC="images/delete.gif" ALT="[ delete zone ]" BORDER="0"></A><? |
|
176 } |
|
177 else |
|
178 { |
|
179 print " "; |
|
180 } |
|
181 ?> |
|
182 </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><? |
|
183 print "\n"; |
|
184 } |
|
185 } |
|
186 |
|
187 ?> |
|
188 </TABLE> |
|
189 |
|
190 <small>You only administer some records of domains marked with an (*)</small> |
|
191 |
|
192 <? |
|
193 if (level(5)) |
|
194 { |
|
195 // Get some data. |
|
196 $server_types = array("MASTER", "SLAVE", "NATIVE"); |
|
197 $users = show_users(); |
|
198 ?> |
|
199 <BR><BR> |
|
200 <FORM METHOD="post" ACTION="index.php"> |
|
201 <B>Create new domain:</B><BR> |
|
202 <TABLE BORDER="0" CELLSPACING="4"> |
|
203 <TR><TD CLASS="tdbg">Domain name:</TD><TD WIDTH="510" CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="domain" VALUE="<? if ($error) print $_POST["domain"]; ?>"></TD></TR> |
|
204 <TR><TD CLASS="tdbg">Web IP:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="webip" VALUE="<? if ($error) print $_POST["webip"]; ?>"></TD></TR> |
|
205 <TR><TD CLASS="tdbg">Mail IP:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="mailip" VALUE="<? if ($error) print $_POST["mailip"]; ?>"></TD></TR> |
|
206 <TR><TD CLASS="tdbg">Owner:</TD><TD CLASS="tdbg"> |
|
207 <SELECT NAME="owner"> |
|
208 <? |
|
209 foreach ($users as $u) |
|
210 { |
|
211 ?><OPTION VALUE="<?= $u['id'] ?>"><?= $u['fullname'] ?></OPTION><? |
|
212 } |
|
213 ?> |
|
214 </SELECT> |
|
215 </TD></TR> |
|
216 <? |
|
217 if($MASTER_SLAVE_FUNCTIONS == true) |
|
218 { |
|
219 ?> |
|
220 <TR><TD CLASS="tdbg">Domain type:</TD><TD CLASS="tdbg"> |
|
221 <SELECT NAME="dom_type"> |
|
222 <? |
|
223 foreach($server_types as $s) |
|
224 { |
|
225 ?><OPTION VALUE="<?=$s?>"><?=$s ?></OPTION><? |
|
226 } |
|
227 ?> |
|
228 </SELECT> |
|
229 </TD></TR> |
|
230 <? } ?> |
|
231 <TR><TD CLASS="tdbg">Create zone without<BR>applying records-template:</TD><TD CLASS="tdbg"><INPUT TYPE="checkbox" NAME="empty" VALUE="1"></TD></TR> |
|
232 <TR><TD CLASS="tdbg"> </TD><TD CLASS="tdbg"><INPUT TYPE="submit" CLASS="button" NAME="submit" VALUE="Add domain"></TD></TR> |
|
233 </TABLE> |
|
234 </FORM> |
|
235 <? |
|
236 } |
|
237 ?> |
|
238 |
|
239 <BR><BR> |
|
240 <FORM METHOD="post" ACTION="index.php"> |
|
241 <B>Change your password:</B><BR> |
|
242 <TABLE BORDER="0" CELLSPACING="4"> |
|
243 <TR><TD CLASS="tdbg">Current password:</TD><TD WIDTH="510" CLASS="tdbg"><INPUT TYPE="password" CLASS="input" NAME="currentpass" VALUE=""></TD></TR> |
|
244 <TR><TD CLASS="tdbg">New Password:</TD><TD WIDTH="510" CLASS="tdbg"><INPUT TYPE="password" CLASS="input" NAME="newpass" VALUE=""></TD></TR> |
|
245 <TR><TD CLASS="tdbg">New Password:</TD><TD WIDTH="510" CLASS="tdbg"><INPUT TYPE="password" CLASS="input" NAME="newpass2" VALUE=""></TD></TR> |
|
246 <TR><TD CLASS="tdbg"> </TD><TD CLASS="tdbg"><INPUT TYPE="submit" CLASS="button" NAME="passchange" VALUE="Change password"></TD></TR> |
|
247 </TABLE> |
|
248 </FORM> |
|
249 <? |
|
250 include_once("inc/footer.inc.php"); |
|
251 ?> |