Update of /cvsroot/phplib/php-lib/pages/admin
In directory usw-pr-cvs1:/tmp/cvs-serv12904
Modified Files:
new_user.php3 new_user_md5.php3
Log Message:
Fixed a possible warning thrown by implode in new_user.php3.
Brought new_user_md5.php3 into sync with the -stable version.
Index: new_user.php3
===================================================================
RCS file: /cvsroot/phplib/php-lib/pages/admin/new_user.php3,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** new_user.php3 2000/01/17 16:16:16 1.11
--- new_user.php3 2001/08/15 08:23:04 1.12
***************
*** 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/pages/admin/new_user_md5.php3,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** new_user_md5.php3 2000/01/17 16:16:16 1.6
--- new_user_md5.php3 2001/08/15 08:23:04 1.7
***************
*** 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,155 ****
## Create a uid and insert the user...
$u_id=md5(uniqid($hash_secret));
! ## Fish out actual permissions from an array shipped in by PHP
! $realperms=implode(',',$perms);
! $query = "insert into auth_user_md5 values('$u_id','$username','$password','$realperms')";
$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) {
***************
*** 189,195 ****
## Update user information.
! ## Get permissions from the array
! $realperms=implode(',',$perms);
! $query = "update auth_user_md5 set p_username='$username', p_password='$password', p_perms='$realperms' where p_user_id='$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 p_username='$username', p_password='$password', p_perms='$permlist' where p_user_id='$u_id'";
$db->query($query);
if ($db->affected_rows() == 0) {
|