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) { echo "You can not create a new user.
"; } else { pg_exec($this->database, "INSERT INTO usr (username, security_level) VALUES ('" . $_POST['username'] . "','" . $_POST['seclevel'] . "')"); } } if (isset($_POST['action']) && $_POST['action'] == 'Remove' && !empty($_POST['username'])) { pg_exec($this->database, "DELETE FROM usr WHERE username='" . $_POST['username'] . "'"); pg_exec($this->database, "DROP USER " . $_POST['username']); } if (isset($_POST['action']) && $_POST['action'] == 'Change Password') { pg_exec($this->database, "ALTER USER " . $_SESSION['username'] . " PASSWORD '" . $_POST['passwd'] . "'"); } $res = pg_exec($this->database, "SELECT username, security_level FROM usr ORDER BY username"); echo "
"; $usr = 0; while ($usr < pg_numrows($res)) { $u = pg_fetch_object($res, $usr); ?>
username ?>
Sec. Level security_level ?>
username) { ?>
"; ?>
Create new user:
User name:
Group:
View
Operator
Admin
Security level:
1
2
3
4
5
Password:
Verify password:
Change your password:
New Password:
Verify password:
Showpage(); ?>