Update of /cvsroot/phplib/php-lib-stable/pages/admin
In directory usw-pr-cvs1:/tmp/cvs-serv15188
Modified Files:
new_user.php3 new_user_md5.php3
Log Message:
Fixed a possible warning thrown by implode if $perms was empty.
Fixed a bunch of errors in new_user_md5.php3.
Index: new_user.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/pages/admin/new_user.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** new_user.php3 2000/07/12 18:22:32 1.2
--- new_user.php3 2001/08/15 08:34:43 1.3
***************
*** 108,111 ****
--- 108,117 ----
$db = new DB_Example;
+ ## $perms array will be unset if a user has had all perms removed.
+ ## If so, set $perms to an empty array to prevent errors from implode.
+ if (empty($perms)) {
+ $perms = array();
+ }
+
// Check if there was a submission
while (is_array($HTTP_POST_VARS)
Index: new_user_md5.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/pages/admin/new_user_md5.php3,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** new_user_md5.php3 2000/04/17 16:40:08 1.1.1.1
--- new_user_md5.php3 2001/08/15 08:34:43 1.2
***************
*** 82,88 ****
<head>
<!--
! // here i include my personal meta-tags; one of those might be useful:
! // <META HTTP-EQUIV="REFRESH" CONTENT="<?php print $auth->lifetime*60;?>; URL=logoff.html">
! // <?php include($_PHPLIB["libdir"] . "meta.inc");?>
-->
<title>User Admin</title>
--- 82,86 ----
<head>
<!--
! <META HTTP-EQUIV="REFRESH" CONTENT="<?php print $auth->lifetime*60;?>; URL=logoff.html">
-->
<title>User Admin</title>
***************
*** 94,102 ****
-->
</style>
! <script language="javascript" src="/session/md5.js"></script>
</head>
<body bgcolor="#ffffff">
<h1>User Administration</h1>
<?php
--- 92,106 ----
-->
</style>
! <script language="javascript" src="../md5.js"></script>
</head>
<body bgcolor="#ffffff">
<h1>User Administration</h1>
+ <P>
+ You are logged in as <b><?php print $auth->auth["uname"] ?></b>
+ with admin level <b><?php print $auth->auth["perm"] ?></b>.<BR>
+ Your authentication is valid until
+ <?php print date("d M Y, H:i:s", $auth->auth["exp"])?>.
+ </P>
<?php
***************
*** 119,122 ****
--- 123,132 ----
}
+ ## $perms array will be unset if a user has had all perms removed.
+ ## If so, set $perms to an empty array to prevent errors from implode.
+ if (empty($perms)) {
+ $perms = array();
+ }
+
## Check if there was a submission
while ( is_array($HTTP_POST_VARS)
***************
*** 149,153 ****
## Create a uid and insert the user...
$u_id=md5(uniqid($hash_secret));
! $query = "insert into auth_user_md5 values('$u_id','$username','$password','$perms')";
$db->query($query);
if ($db->affected_rows() == 0) {
--- 159,164 ----
## Create a uid and insert the user...
$u_id=md5(uniqid($hash_secret));
! $permlist = addslashes(implode($perms,","));
! $query = "insert into auth_user_md5 values('$u_id','$username','$password','$permlist')";
$db->query($query);
if ($db->affected_rows() == 0) {
***************
*** 169,173 ****
## Handle users changing their own password...
if (!$perm->have_perm("admin")) {
! $query = "update auth_user_md5 set password='$password' where uid='$u_id'";
$db->query($query);
if ($db->affected_rows() == 0) {
--- 180,184 ----
## Handle users changing their own password...
if (!$perm->have_perm("admin")) {
! $query = "update auth_user_md5 set password='$password' where user_id='$u_id'";
$db->query($query);
if ($db->affected_rows() == 0) {
***************
*** 187,191 ****
## Update user information.
! $query = "update auth_user_md5 set username='$username', password='$password', perms='$perms' where uid='$u_id'";
$db->query($query);
if ($db->affected_rows() == 0) {
--- 198,203 ----
## Update user information.
! $permlist = addslashes(implode($perms,","));
! $query = "update auth_user_md5 set username='$username', password='$password', perms='$permlist' where user_id='$u_id'";
$db->query($query);
if ($db->affected_rows() == 0) {
***************
*** 206,210 ****
## Delete that user.
! $query = "delete from auth_user_md5 where uid='$u_id' and username='$username'";
$db->query($query);
if ($db->affected_rows() == 0) {
--- 218,222 ----
## Delete that user.
! $query = "delete from auth_user_md5 where user_id='$u_id' and username='$username'";
$db->query($query);
if ($db->affected_rows() == 0) {
***************
*** 289,293 ****
<td align=right>
! <input type="hidden" name="u_id" value="<?php $db->p("uid") ?>">
<input type="submit" name="u_kill" value="Kill">
<input onClick="doEditUser(); return true;" type="submit" name="u_edit" value="Change">
--- 301,305 ----
<td align=right>
! <input type="hidden" name="u_id" value="<?php $db->p("user_id") ?>">
<input type="submit" name="u_kill" value="Kill">
<input onClick="doEditUser(); return true;" type="submit" name="u_edit" value="Change">
***************
*** 300,304 ****
<td><?php $db->p("perms") ?></td>
<td align=right>
! <input type="hidden" name="u_id" value="<?php $db->p("uid") ?>">
<input onClick="doEditUser(); return true;" type="submit" name="u_edit" value="Change">
</td>
--- 312,316 ----
<td><?php $db->p("perms") ?></td>
<td align=right>
! <input type="hidden" name="u_id" value="<?php $db->p("user_id") ?>">
<input onClick="doEditUser(); return true;" type="submit" name="u_edit" value="Change">
</td>
|