From 26539cca2b6658c6615b502068b8202ecf0981d6 Mon Sep 17 00:00:00 2001 From: arjen Date: Sat, 10 Jan 2004 20:03:02 +0000 Subject: [PATCH] *** empty log message *** --- src/web/users.php | 68 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/src/web/users.php b/src/web/users.php index 3af9ea5..ef2ab22 100644 --- a/src/web/users.php +++ b/src/web/users.php @@ -9,7 +9,7 @@ *********************** ** FILE NAME : users.php ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring -** VERSION NUMBER : $Revision: 1.3 $ +** VERSION NUMBER : $Revision: 1.4 $ ** ** DESCRIPTION : User Administration page. ** Input parameters: action (POST) : empty, 'Create' @@ -29,7 +29,10 @@ /***************************** $Log: users.php,v $ - Revision 1.3 2003-02-21 08:44:19 arjen + Revision 1.4 2004-01-10 20:03:02 arjen + *** empty log message *** + + Revision 1.3 2003/02/21 08:44:19 arjen Add a new user and make him/her a member of a group. Change of passwords added. @@ -38,7 +41,7 @@ ******************************/ -// RCSID = "$Id: users.php,v 1.3 2003-02-21 08:44:19 arjen Exp $"; +// RCSID = "$Id: users.php,v 1.4 2004-01-10 20:03:02 arjen Exp $"; ini_set('include_path', '.:./classes:../phpclasses'); @@ -102,15 +105,15 @@ class user_page extends page function Body() { - echo "

User Administration


"; if (isset($_POST['action']) && $_POST['action'] == 'Create' && !empty($_POST['username'])) { $query = "CREATE USER " . $_POST['username'] . " PASSWORD '" . $_POST['passwd'] . "' IN GROUP " . $_POST['group']; - if (pg_exec($this->database, $query) == FALSE) + if (pg_exec($this->database, $query) == FALSE && + strstr(pg_errormessage($this->database), "already exists") == false) { - echo "You can not create a new user.
"; + echo "You can not create a new user: " . pg_errormessage($this->database) . ".
"; } else { @@ -131,7 +134,51 @@ class user_page extends page " PASSWORD '" . $_POST['passwd'] . "'"); } - $res = pg_exec($this->database, "SELECT username, security_level FROM usr ORDER BY username"); + if (isset($_GET['username'])) + { + echo "

Detailed information for user " . $_GET['username'] . "


\n"; + + if (isset($_POST['action']) && $_POST['action'] == 'Save Changes') + { + $qry = "UPDATE usr SET display_name='" . $_POST['dspname'] . "'"; + $qry .= ", email='" . $_POST['email'] . "'"; + $qry .= ", security_level='" . $_POST['seclevel'] . "'"; + $qry .= " WHERE username='" . $_GET['username'] . "'"; + + pg_exec($this->database, $qry); + } + $res = pg_exec($this->database, "SELECT * from usr + WHERE username='" . $_GET['username'] . "'"); + $usr = pg_fetch_object($res, 0); + + echo "
"; + echo ""; + + echo ""; + echo ""; + + echo ""; + echo "
Display name
Email address
Security level
"; + echo ""; + echo "
"; + } + else + { + echo "

User Administration


"; + $res = pg_exec($this->database, "SELECT username, display_name, email, security_level + FROM usr ORDER BY username"); echo ""; $usr = 0; @@ -139,9 +186,13 @@ class user_page extends page { $u = pg_fetch_object($res, $usr); ?> -

+

username ?>
+ display_name ?> + + email ?> + Sec. Level security_level ?> username) @@ -196,6 +247,7 @@ Verify password: