1
|
1 |
<?php |
|
2 |
|
|
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 |
// $Id: users.php,v 1.11 2003/02/05 23:22:33 azurazu Exp $ |
|
18 |
// |
|
19 |
|
|
20 |
require_once("inc/toolkit.inc.php"); |
|
21 |
|
|
22 |
if($_POST["submit"] |
|
23 |
&& $_POST["username"] != "" |
|
24 |
&& $_POST["password"] != "" |
|
25 |
&& $_POST["fullname"] != "" |
|
26 |
&& $_POST["email"] != "" |
|
27 |
&& $_POST["level"] > 0) |
|
28 |
{ |
|
29 |
if(substr_count($_POST["username"], " ") == 0) |
|
30 |
{ |
|
31 |
add_user($_POST["username"], $_POST["password"], $_POST["fullname"], $_POST["email"], $_POST["level"], $_POST["description"], $_POST["active"]); |
|
32 |
clean_page($BASE_URL . $BASE_PATH . "users.php"); |
|
33 |
} |
|
34 |
else |
|
35 |
{ |
3
|
36 |
$error = _('Usernames can\'t contain spaces'); |
1
|
37 |
} |
|
38 |
} |
|
39 |
elseif($_POST["submit"]) |
|
40 |
{ |
2
|
41 |
$error = _('Please fill in all fields'); |
1
|
42 |
} |
|
43 |
|
|
44 |
// Dirty hack, maybe revise? |
|
45 |
include_once("inc/header.inc.php"); |
|
46 |
?> |
3
|
47 |
<H2><? echo _('User admin'); ?></H2> |
1
|
48 |
<P CLASS="nav"> |
8
|
49 |
<A HREF="index.php"><? echo _('DNS Admin'); ?></A> <A HREF="search.php"><? echo _('Search records'); ?></A></P><BR><? |
1
|
50 |
// End |
|
51 |
|
|
52 |
if (!level(10)) |
|
53 |
{ |
|
54 |
error(ERR_LEVEL_10); |
|
55 |
} |
|
56 |
|
|
57 |
if ($error != "") |
|
58 |
{ |
2
|
59 |
?><H3><FONT COLOR="red"><? echo _('Error'); ?>: <?= $error ?></FONT></H3><? |
1
|
60 |
} |
|
61 |
|
2
|
62 |
echo "<B>" . _('Current users (click to edit)') . ":</B>"; |
1
|
63 |
|
|
64 |
$users = show_users(''); |
|
65 |
|
2
|
66 |
echo "<br /><br /><small><b>" . _('Number of users') . ":</b> ".count($users); |
1
|
67 |
|
|
68 |
show_pages(count($users),ROWAMOUNT); |
|
69 |
?> |
|
70 |
|
|
71 |
<br /><br /><TABLE BORDER="0" CELLSPACING="4"> |
2
|
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> |
1
|
73 |
<? |
|
74 |
$users = show_users('',ROWSTART,ROWAMOUNT); |
|
75 |
foreach ($users as $c) |
|
76 |
{ |
|
77 |
?> |
|
78 |
<TR> |
3
|
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> |
1
|
80 |
<TD VALIGN="top" CLASS="tdbg"><A HREF="edit_user.php?id=<?= $c["id"] ?>"><?= $c["fullname"] ?></A> (<?= $c["username"] ?>)</TD> |
|
81 |
<TD VALIGN="top" CLASS="tdbg"><?= $c["numdomains"] ?></TD> |
9
|
82 |
<TD VALIGN="top" CLASS="tdbg"> |
1
|
83 |
<? |
|
84 |
$domains = get_domains_from_userid($c["id"]); |
|
85 |
foreach ($domains as $d) |
|
86 |
{ |
3
|
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><? |
1
|
88 |
} |
9
|
89 |
?></TD><TD VALIGN="top" CLASS="tdbg"><?= $c["level"] ?></TD><TD VALIGN="top" CLASS="tdbg"><?= get_status($c["active"]) ?></TD></TR><? |
1
|
90 |
print "\n"; |
|
91 |
} |
|
92 |
?> |
|
93 |
</TABLE> |
|
94 |
<BR><BR> |
|
95 |
|
|
96 |
<FORM METHOD="post" action="users.php"> |
2
|
97 |
<B><? echo _('Create new user'); ?>:</B><BR> |
1
|
98 |
<TABLE BORDER="0" CELLSPACING="4"> |
2
|
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> |
|
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> |
|
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> |
|
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> |
|
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> |
|
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> |
|
105 |
<TR><TD CLASS="tdbg"><? echo _('Active'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="checkbox" NAME="active" VALUE="1" CHECKED></TD></TR> |
|
106 |
<TR><TD CLASS="tdbg"> </TD><TD CLASS="tdbg"><INPUT TYPE="submit" CLASS="button" NAME="submit" VALUE="<? echo _('Add user'); ?>"></TD></TR> |
1
|
107 |
</TABLE> |
|
108 |
</FORM> |
|
109 |
<? |
|
110 |
include_once("inc/footer.inc.php"); |
|
111 |
?> |