users.php
author rejo
Wed, 18 Apr 2007 22:48:49 +0000
changeset 7 ac0ca51809b1
parent 3 64525a2eb098
child 8 47dd15d8bb8c
permissions -rw-r--r--
[feladat @ 8] - Removal of left-over backup file.
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">
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    49
<A HREF="index.php"><? echo _('DNS Admin'); ?></A>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    50
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    51
if (level(10))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    52
{
3
64525a2eb098 [feladat @ 4]
rejo
parents: 2
diff changeset
    53
	?> <A HREF="seq_update.php"><? echo _('Synchronize database'); ?></A> <?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    54
}
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    55
?><A HREF="search.php"><? echo _('Search records'); ?></A></P><BR><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    56
// End
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    57
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    58
if (!level(10)) 
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    59
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    60
	error(ERR_LEVEL_10);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    61
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    62
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    63
if ($error != "") 
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    64
{
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    65
        ?><H3><FONT COLOR="red"><? echo _('Error'); ?>: <?= $error ?></FONT></H3><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    66
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    67
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    68
echo "<B>" . _('Current users (click to edit)') . ":</B>";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    69
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    70
$users = show_users('');
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    71
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    72
echo "<br /><br /><small><b>" . _('Number of users') . ":</b> ".count($users);
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    73
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    74
show_pages(count($users),ROWAMOUNT);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    75
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    76
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    77
<br /><br /><TABLE BORDER="0" CELLSPACING="4">
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
    78
<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
    79
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    80
$users = show_users('',ROWSTART,ROWAMOUNT);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    81
foreach ($users as $c)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    82
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    83
        ?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    84
        <TR>
3
64525a2eb098 [feladat @ 4]
rejo
parents: 2
diff changeset
    85
        <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
    86
        <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
    87
        <TD VALIGN="top" CLASS="tdbg"><?= $c["numdomains"] ?></TD>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    88
        <TD CLASS="tdbg">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    89
        <?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    90
        $domains = get_domains_from_userid($c["id"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    91
        foreach ($domains as $d)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    92
        {
3
64525a2eb098 [feladat @ 4]
rejo
parents: 2
diff changeset
    93
                ?><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
    94
        }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    95
        ?></TD><TD CLASS="tdbg"><?= $c["level"] ?></TD><TD VALIGN="middle" CLASS="tdbg"><?= get_status($c["active"]) ?></TD></TR><?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    96
        print "\n";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    97
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    98
?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    99
</TABLE>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   100
<BR><BR>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   101
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   102
<FORM METHOD="post" action="users.php">
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   103
<B><? echo _('Create new user'); ?>:</B><BR>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   104
<TABLE BORDER="0" CELLSPACING="4">
2
9a485c41cfcf [feladat @ 3]
rejo
parents: 1
diff changeset
   105
<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
   106
<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
   107
<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
   108
<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
   109
<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
   110
<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
   111
<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
   112
<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
   113
</TABLE>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   114
</FORM>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   115
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   116
include_once("inc/footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   117
?>