1
|
1 |
<?php |
|
2 |
|
|
3 |
require_once("inc/toolkit.inc.php"); |
|
4 |
|
|
5 |
if($_POST["submit"] |
|
6 |
&& $_POST["username"] != "" |
|
7 |
&& $_POST["password"] != "" |
|
8 |
&& $_POST["fullname"] != "" |
|
9 |
&& $_POST["email"] != "" |
|
10 |
&& $_POST["level"] > 0) |
|
11 |
{ |
|
12 |
if(substr_count($_POST["username"], " ") == 0) |
|
13 |
{ |
13
|
14 |
if(strlen($_POST["password"]) < 8) |
|
15 |
{ |
|
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 |
} |
1
|
24 |
else |
|
25 |
{ |
3
|
26 |
$error = _('Usernames can\'t contain spaces'); |
1
|
27 |
} |
|
28 |
} |
|
29 |
elseif($_POST["submit"]) |
|
30 |
{ |
2
|
31 |
$error = _('Please fill in all fields'); |
1
|
32 |
} |
|
33 |
|
|
34 |
include_once("inc/header.inc.php"); |
13
|
35 |
if ($error != "") |
|
36 |
{ |
1
|
37 |
?> |
13
|
38 |
<div class="error"><? echo $error ; ?></div> |
|
39 |
<? |
|
40 |
} |
|
41 |
?> |
|
42 |
<h2><? echo _('User admin'); ?></h2> |
|
43 |
<? |
1
|
44 |
if (!level(10)) |
|
45 |
{ |
|
46 |
error(ERR_LEVEL_10); |
|
47 |
} |
13
|
48 |
?> |
|
49 |
<h3><? echo _('Current users'); ?></h3> |
|
50 |
<? |
1
|
51 |
$users = show_users(''); |
13
|
52 |
?> |
1
|
53 |
|
13
|
54 |
<table> |
|
55 |
<tr> |
|
56 |
<th> </th> |
|
57 |
<th><? echo _('Name'); ?></th> |
|
58 |
<th><? echo _('Zones'); ?></th> |
|
59 |
<th><? echo _('Zone list'); ?></th> |
|
60 |
<th><? echo _('Level'); ?></th> |
|
61 |
<th><? echo _('Status'); ?></th> |
|
62 |
</tr> |
1
|
63 |
<? |
|
64 |
$users = show_users('',ROWSTART,ROWAMOUNT); |
|
65 |
foreach ($users as $c) |
|
66 |
{ |
13
|
67 |
?> |
|
68 |
<tr> |
|
69 |
<td class="n"><a href="delete_user.php?id=<? echo $c["id"] ?>"><img src="images/delete.gif" alt="[ <? echo _('Delete user'); ?> ]"></a></td> |
|
70 |
<td class="n"><a href="edit_user.php?id=<? echo $c["id"] ?>"><? echo $c["fullname"] ?></A> (<? echo $c["username"] ?>)</td> |
|
71 |
<td class="n"><? echo $c["numdomains"] ?></td> |
|
72 |
<td class="n"> |
1
|
73 |
<? |
|
74 |
$domains = get_domains_from_userid($c["id"]); |
|
75 |
foreach ($domains as $d) |
|
76 |
{ |
13
|
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><? |
1
|
78 |
} |
13
|
79 |
?></td> |
|
80 |
<td class="n"><? echo $c["level"] ?></td> |
|
81 |
<td class="n"><? echo get_status($c["active"]) ?></td> |
|
82 |
</tr><? |
1
|
83 |
print "\n"; |
|
84 |
} |
|
85 |
?> |
13
|
86 |
</table> |
|
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 ?> |
1
|
93 |
|
13
|
94 |
<h3><? echo _('Create new user'); ?></h3> |
|
95 |
<form method="post" action="users.php"> |
|
96 |
<table> |
|
97 |
<tr> |
|
98 |
<td class="n"><? echo _('User name'); ?>:</td> |
|
99 |
<td class="n"><input type="text" class="input" name="username" value="<? if ($error) print $_POST["username"]; ?>"></td> |
|
100 |
</tr> |
|
101 |
<tr> |
|
102 |
<td class="n"><? echo _('Full name'); ?>:</td> |
|
103 |
<td class="n"><input type="text" class="input" NAME="fullname" VALUE="<? if ($error) print $_POST["fullname"]; ?>"></td> |
|
104 |
</tr> |
|
105 |
<tr> |
|
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> |
1
|
137 |
<? |
|
138 |
include_once("inc/footer.inc.php"); |
|
139 |
?> |