26 && $_POST["email"] != "" |
9 && $_POST["email"] != "" |
27 && $_POST["level"] > 0) |
10 && $_POST["level"] > 0) |
28 { |
11 { |
29 if(substr_count($_POST["username"], " ") == 0) |
12 if(substr_count($_POST["username"], " ") == 0) |
30 { |
13 { |
31 add_user($_POST["username"], $_POST["password"], $_POST["fullname"], $_POST["email"], $_POST["level"], $_POST["description"], $_POST["active"]); |
14 if(strlen($_POST["password"]) < 8) |
32 clean_page($BASE_URL . $BASE_PATH . "users.php"); |
15 { |
33 } |
16 $error = _('Password length should be at least 8 characters.'); |
|
17 } |
|
18 else |
|
19 { |
|
20 add_user($_POST["username"], $_POST["password"], $_POST["fullname"], $_POST["email"], $_POST["level"], $_POST["description"], $_POST["active"]); |
|
21 clean_page($BASE_URL . $BASE_PATH . "users.php"); |
|
22 } |
|
23 } |
34 else |
24 else |
35 { |
25 { |
36 $error = _('Usernames can\'t contain spaces'); |
26 $error = _('Usernames can\'t contain spaces'); |
37 } |
27 } |
38 } |
28 } |
39 elseif($_POST["submit"]) |
29 elseif($_POST["submit"]) |
40 { |
30 { |
41 $error = _('Please fill in all fields'); |
31 $error = _('Please fill in all fields'); |
42 } |
32 } |
43 |
33 |
44 // Dirty hack, maybe revise? |
|
45 include_once("inc/header.inc.php"); |
34 include_once("inc/header.inc.php"); |
|
35 if ($error != "") |
|
36 { |
46 ?> |
37 ?> |
47 <H2><? echo _('User admin'); ?></H2> |
38 <div class="error"><? echo $error ; ?></div> |
48 <P CLASS="nav"> |
39 <? |
49 <A HREF="index.php"><? echo _('DNS Admin'); ?></A> <A HREF="search.php"><? echo _('Search records'); ?></A></P><BR><? |
40 } |
50 // End |
41 ?> |
51 |
42 <h2><? echo _('User admin'); ?></h2> |
|
43 <? |
52 if (!level(10)) |
44 if (!level(10)) |
53 { |
45 { |
54 error(ERR_LEVEL_10); |
46 error(ERR_LEVEL_10); |
55 } |
47 } |
|
48 ?> |
|
49 <h3><? echo _('Current users'); ?></h3> |
|
50 <? |
|
51 $users = show_users(''); |
|
52 ?> |
56 |
53 |
57 if ($error != "") |
54 <table> |
58 { |
55 <tr> |
59 ?><H3><FONT COLOR="red"><? echo _('Error'); ?>: <?= $error ?></FONT></H3><? |
56 <th> </th> |
60 } |
57 <th><? echo _('Name'); ?></th> |
61 |
58 <th><? echo _('Zones'); ?></th> |
62 echo "<B>" . _('Current users (click to edit)') . ":</B>"; |
59 <th><? echo _('Zone list'); ?></th> |
63 |
60 <th><? echo _('Level'); ?></th> |
64 $users = show_users(''); |
61 <th><? echo _('Status'); ?></th> |
65 |
62 </tr> |
66 echo "<br /><br /><small><b>" . _('Number of users') . ":</b> ".count($users); |
|
67 |
|
68 show_pages(count($users),ROWAMOUNT); |
|
69 ?> |
|
70 |
|
71 <br /><br /><TABLE BORDER="0" CELLSPACING="4"> |
|
72 <TR STYLE="font-weight: Bold;"><TD CLASS="tdbg"> </TD><TD CLASS="tdbg"><? echo _('Name'); ?></TD><TD CLASS="tdbg"><? echo _('Domains'); ?></TD><TD CLASS="tdbg"><? echo _('Domain list'); ?></TD><TD CLASS="tdbg"><? echo _('Level'); ?></TD><TD CLASS="tdbg"><? echo _('Status'); ?></TD></TR> |
|
73 <? |
63 <? |
74 $users = show_users('',ROWSTART,ROWAMOUNT); |
64 $users = show_users('',ROWSTART,ROWAMOUNT); |
75 foreach ($users as $c) |
65 foreach ($users as $c) |
76 { |
66 { |
77 ?> |
67 ?> |
78 <TR> |
68 <tr> |
79 <TD VALIGN="top" CLASS="tdbg"><A HREF="delete_user.php?id=<?= $c["id"] ?>"><IMG SRC="images/delete.gif" ALT="[ <? echo _('Delete user'); ?> ]" BORDER="0"></A></TD> |
69 <td class="n"><a href="delete_user.php?id=<? echo $c["id"] ?>"><img src="images/delete.gif" alt="[ <? echo _('Delete user'); ?> ]"></a></td> |
80 <TD VALIGN="top" CLASS="tdbg"><A HREF="edit_user.php?id=<?= $c["id"] ?>"><?= $c["fullname"] ?></A> (<?= $c["username"] ?>)</TD> |
70 <td class="n"><a href="edit_user.php?id=<? echo $c["id"] ?>"><? echo $c["fullname"] ?></A> (<? echo $c["username"] ?>)</td> |
81 <TD VALIGN="top" CLASS="tdbg"><?= $c["numdomains"] ?></TD> |
71 <td class="n"><? echo $c["numdomains"] ?></td> |
82 <TD VALIGN="top" CLASS="tdbg"> |
72 <td class="n"> |
83 <? |
73 <? |
84 $domains = get_domains_from_userid($c["id"]); |
74 $domains = get_domains_from_userid($c["id"]); |
85 foreach ($domains as $d) |
75 foreach ($domains as $d) |
86 { |
76 { |
87 ?><A HREF="delete_domain.php?id=<?= $d["id"] ?>"><IMG SRC="images/delete.gif" ALT="[ <? echo _('Delete domain'); ?> ]" BORDER="0"></A> <A HREF="edit.php?id=<?= $d["id"] ?>"><?= $d["name"] ?></A><BR><? |
77 ?><a href="delete_domain.php?id=<? echo $d["id"] ?>"><img src="images/delete.gif" alt="[ <? echo _('Delete domain'); ?> ]"></a> <a href="edit.php?id=<? echo $d["id"] ?>"><? echo $d["name"] ?></a><br><? |
88 } |
78 } |
89 ?></TD><TD VALIGN="top" CLASS="tdbg"><?= $c["level"] ?></TD><TD VALIGN="top" CLASS="tdbg"><?= get_status($c["active"]) ?></TD></TR><? |
79 ?></td> |
|
80 <td class="n"><? echo $c["level"] ?></td> |
|
81 <td class="n"><? echo get_status($c["active"]) ?></td> |
|
82 </tr><? |
90 print "\n"; |
83 print "\n"; |
91 } |
84 } |
92 ?> |
85 ?> |
93 </TABLE> |
86 </table> |
94 <BR><BR> |
87 <p><? echo _('Number of users') ;?>: <? echo count($users); ?>.</p> |
|
88 <div class="showmax"> |
|
89 <? |
|
90 show_pages(count($users),ROWAMOUNT); |
|
91 ?> |
|
92 </div> <? // eo div showmax ?> |
95 |
93 |
96 <FORM METHOD="post" action="users.php"> |
94 <h3><? echo _('Create new user'); ?></h3> |
97 <B><? echo _('Create new user'); ?>:</B><BR> |
95 <form method="post" action="users.php"> |
98 <TABLE BORDER="0" CELLSPACING="4"> |
96 <table> |
99 <TR><TD CLASS="tdbg"><? echo _('User name'); ?>:</TD><TD WIDTH="510" CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="username" VALUE="<? if ($error) print $_POST["username"]; ?>"></TD></TR> |
97 <tr> |
100 <TR><TD CLASS="tdbg"><? echo _('Full name'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="fullname" VALUE="<? if ($error) print $_POST["fullname"]; ?>"></TD></TR> |
98 <td class="n"><? echo _('User name'); ?>:</td> |
101 <TR><TD CLASS="tdbg"><? echo _('Password'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="password" VALUE="<? if ($error) print $_POST["password"]; ?>"></TD></TR> |
99 <td class="n"><input type="text" class="input" name="username" value="<? if ($error) print $_POST["username"]; ?>"></td> |
102 <TR><TD CLASS="tdbg"><? echo _('E-mail'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="text" CLASS="input" NAME="email" VALUE="<? if ($error) print $_POST["email"]; ?>"></TD></TR> |
100 </tr> |
103 <TR><TD CLASS="tdbg"><? echo _('User level'); ?>:</TD><TD CLASS="tdbg"><SELECT NAME="level"><OPTION VALUE="1">1 (<?= leveldescription(1) ?>)</OPTION><OPTION VALUE="5">5 (<?= leveldescription(5) ?>)</OPTION><OPTION VALUE="10">10 (<?= leveldescription(10) ?>)</OPTION></SELECT></TD></TR> |
101 <tr> |
104 <TR><TD CLASS="tdbg"><? echo _('Description'); ?>:</TD><TD CLASS="tdbg"><TEXTAREA ROWS="6" COLS="30" CLASS="inputarea" NAME="description"><? if ($error) print $_POST["description"]; ?></TEXTAREA></TD></TR> |
102 <td class="n"><? echo _('Full name'); ?>:</td> |
105 <TR><TD CLASS="tdbg"><? echo _('Active'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="checkbox" NAME="active" VALUE="1" CHECKED></TD></TR> |
103 <td class="n"><input type="text" class="input" NAME="fullname" VALUE="<? if ($error) print $_POST["fullname"]; ?>"></td> |
106 <TR><TD CLASS="tdbg"> </TD><TD CLASS="tdbg"><INPUT TYPE="submit" CLASS="button" NAME="submit" VALUE="<? echo _('Add user'); ?>"></TD></TR> |
104 </tr> |
107 </TABLE> |
105 <tr> |
108 </FORM> |
106 <td class="n"><? echo _('Password'); ?>:</td> |
|
107 <td class="n"><input type="text" class="input" NAME="password" VALUE="<? if ($error) print $_POST["password"]; ?>"></td> |
|
108 </tr> |
|
109 <tr> |
|
110 <td class="n"><? echo _('E-mail'); ?>:</td> |
|
111 <td class="n"><input type="text" class="input" NAME="email" VALUE="<? if ($error) print $_POST["email"]; ?>"></td> |
|
112 </tr> |
|
113 <tr> |
|
114 <td class="n"><? echo _('User level'); ?>:</td> |
|
115 <td class="n"> |
|
116 <select name="level"> |
|
117 <option value="1">1 (<? echo leveldescription(1) ?>)</option> |
|
118 <option value="5">5 (<? echo leveldescription(5) ?>)</option> |
|
119 <option value="10">10 (<? echo leveldescription(10) ?>)</option> |
|
120 </select> |
|
121 </td> |
|
122 </tr> |
|
123 <tr> |
|
124 <td class="n"><? echo _('Description'); ?>:</td> |
|
125 <td class="n"><textarea rows="6" cols="30" class="inputarea" name="description"><? if ($error) print $_POST["description"]; ?></textarea></td> |
|
126 </tr> |
|
127 <tr> |
|
128 <td class="n"><? echo _('Active'); ?>:</td> |
|
129 <td class="n"><input type="checkbox" name="active" value="1" checked></td> |
|
130 </tr> |
|
131 <tr> |
|
132 <td class="n"> </td> |
|
133 <td class="n"><input type="submit" class="button" name="submit" value="<? echo _('Add user'); ?>"></td> |
|
134 </tr> |
|
135 </table> |
|
136 </form> |
109 <? |
137 <? |
110 include_once("inc/footer.inc.php"); |
138 include_once("inc/footer.inc.php"); |
111 ?> |
139 ?> |