users.php
author rejo
Sun, 22 Apr 2007 14:07:04 +0000
changeset 10 68d13494519e
parent 9 d55459cd1712
child 13 2ff220cfde13
permissions -rw-r--r--
[feladat @ 24] Fixed small typo.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     1
<?php
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     2
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     3
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     4
// | PowerAdmin								|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     5
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     6
// | Copyright (c) 1997-2002 The PowerAdmin Team			|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     7
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     8
// | This source file is subject to the license carried by the overal	|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     9
// | program PowerAdmin as found on http://poweradmin.sf.net		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    10
// | The PowerAdmin program falls under the QPL License:		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    11
// | http://www.trolltech.com/developer/licensing/qpl.html		|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    12
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    13
// | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl>	|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    14
// |          Sjeemz <sjeemz <AT> sjeemz <DOT> nl>			|
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    15
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    16
//
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    17
// $Id: users.php,v 1.11 2003/02/05 23:22:33 azurazu Exp $
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    18
//
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    19
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    20
require_once("inc/toolkit.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    21
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
if($_POST["submit"]
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    23
&& $_POST["username"] != ""
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    24
&& $_POST["password"] != "" 
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    25
&& $_POST["fullname"] != ""
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    26
&& $_POST["email"] != ""
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    27
&& $_POST["level"] > 0)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    28
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    29
	if(substr_count($_POST["username"], " ") == 0)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    30
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    31
		add_user($_POST["username"], $_POST["password"], $_POST["fullname"], $_POST["email"], $_POST["level"], $_POST["description"], $_POST["active"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    32
        	clean_page($BASE_URL . $BASE_PATH . "users.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    33
        }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    34
        else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    35
        {
3
64525a2eb098 [feladat @ 4]
rejo
parents: 2
diff changeset
    36
        	$error = _('Usernames can\'t contain spaces');
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    37
        }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    38
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    39
elseif($_POST["submit"])
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    40
{
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    41
	$error = _('Please fill in all fields');
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    42
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    43
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    44
// Dirty hack, maybe revise?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    45
include_once("inc/header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    46
?>
3
64525a2eb098 [feladat @ 4]
rejo
parents: 2
diff changeset
    47
<H2><? echo _('User admin'); ?></H2>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    48
<P CLASS="nav">
8
47dd15d8bb8c [feladat @ 20]
rejo
parents: 3
diff changeset
    49
<A HREF="index.php"><? echo _('DNS Admin'); ?></A> <A HREF="search.php"><? echo _('Search records'); ?></A></P><BR><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    50
// End
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    51
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    52
if (!level(10)) 
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    53
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    54
	error(ERR_LEVEL_10);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    55
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    56
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    57
if ($error != "") 
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    58
{
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    59
        ?><H3><FONT COLOR="red"><? echo _('Error'); ?>: <?= $error ?></FONT></H3><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    60
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    61
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    62
echo "<B>" . _('Current users (click to edit)') . ":</B>";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    63
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    64
$users = show_users('');
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    65
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    66
echo "<br /><br /><small><b>" . _('Number of users') . ":</b> ".count($users);
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    67
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    68
show_pages(count($users),ROWAMOUNT);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    69
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    70
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    71
<br /><br /><TABLE BORDER="0" CELLSPACING="4">
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    72
<TR STYLE="font-weight: Bold;"><TD CLASS="tdbg">&nbsp;</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
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    73
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    74
$users = show_users('',ROWSTART,ROWAMOUNT);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    75
foreach ($users as $c)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    76
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    77
        ?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    78
        <TR>
3
64525a2eb098 [feladat @ 4]
rejo
parents: 2
diff changeset
    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
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    80
        <TD VALIGN="top" CLASS="tdbg"><A HREF="edit_user.php?id=<?= $c["id"] ?>"><?= $c["fullname"] ?></A> (<?= $c["username"] ?>)</TD>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    81
        <TD VALIGN="top" CLASS="tdbg"><?= $c["numdomains"] ?></TD>
9
d55459cd1712 [feladat @ 22]
rejo
parents: 8
diff changeset
    82
        <TD VALIGN="top" CLASS="tdbg">
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    83
        <?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    84
        $domains = get_domains_from_userid($c["id"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    85
        foreach ($domains as $d)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    86
        {
3
64525a2eb098 [feladat @ 4]
rejo
parents: 2
diff changeset
    87
                ?><A HREF="delete_domain.php?id=<?= $d["id"] ?>"><IMG SRC="images/delete.gif" ALT="[ <? echo _('Delete domain'); ?> ]" BORDER="0"></A>&nbsp;<A HREF="edit.php?id=<?= $d["id"] ?>"><?= $d["name"] ?></A><BR><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    88
        }
9
d55459cd1712 [feladat @ 22]
rejo
parents: 8
diff changeset
    89
        ?></TD><TD VALIGN="top" CLASS="tdbg"><?= $c["level"] ?></TD><TD VALIGN="top" CLASS="tdbg"><?= get_status($c["active"]) ?></TD></TR><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    90
        print "\n";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    91
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    92
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    93
</TABLE>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    94
<BR><BR>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    95
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    96
<FORM METHOD="post" action="users.php">
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    97
<B><? echo _('Create new user'); ?>:</B><BR>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    98
<TABLE BORDER="0" CELLSPACING="4">
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    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>
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   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>
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   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>
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   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>
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   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>
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   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>
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   105
<TR><TD CLASS="tdbg"><? echo _('Active'); ?>:</TD><TD CLASS="tdbg"><INPUT TYPE="checkbox" NAME="active" VALUE="1" CHECKED></TD></TR>
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   106
<TR><TD CLASS="tdbg">&nbsp;</TD><TD CLASS="tdbg"><INPUT TYPE="submit" CLASS="button" NAME="submit" VALUE="<? echo _('Add user'); ?>"></TD></TR>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   107
</TABLE>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   108
</FORM>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   109
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   110
include_once("inc/footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   111
?>