Re: [phplib] Problems with new_user_md5.php3 example... From: Andrew Crawford (Andrew <email protected>)
Date: 09/15/00

Yes, I posted a note about this back in March. This originally went to the
PHPLIB developers but, never received a response. Easy bug fix. Here is a
copy of my message. I hope it helps.

Andrew Crawford
Andrew <email protected>

>Date: Mon, 06 Mar 2000 01:54:36 -0700
>To: be <email protected>, kk <email protected>, sascha <email protected>
>From: Andrew Crawford <Andrew <email protected>>
>Subject: Error in new_user_md5.php3
>
>Greetings,
>
>Thank you for PHPLIB. It is a great tool.
>
>In case this hasn't already been brought to your attention, there appear
>to be a few small errors in new_user_md5.php3. One of them causes it to
>set the permissions of users to "Array" ($perm) rather than the actual
>permissions ($permlist.) The other problem is that the user id column
>name for the auth_user_md5 table is "user_id" rather than "u_id." I
>modeled a solution on the code in new_user.php3. Here are the corrected
>sections of new_user_md5.php3:
>
> ## Create a uid and insert the user...
> $permlist = addslashes(implode($perms,","));
> $u_id=md5(uniqid($hash_secret));
> $query = "insert into auth_user_md5
> values('$u_id','$username','$password',\
>'$permlist')";
> $db->query($query);
> if ($db->affected_rows() == 0) {
> my_error("<b>Failed:</b> $query");
> break;
> }
>
> my_msg("User \"$username\" created.<BR>");
> break;
>
>....
>
> ## Update user information.
> $permlist = addslashes(implode($perms,","));
> $query = "update auth_user_md5 set username='$username',
> password='$passwor\
>d', perms='$permlist' where user_id='$u_id'";
> $db->query($query);
> if ($db->affected_rows() == 0) {
> my_error("<b>Failed:</b> $query");
> break;
> }
>
> my_msg("User \"$username\" changed.<BR>");
> break;

At 12:17 AM 9/13/2000 +0200, you wrote:
>Hello,
>
>I have some problems with the example in "pages"-directory of the
>phplib-7.2c.tar.gz:
>
>I tried the example "/pages/admin/new_user_md5.php3". Creating user is
>no problem. But change or killing. The $u_id - Variable seems to be
>empty:
>
>I've got this Error-Message:
>Error: Failed: delete from auth_user_md5 where user_id='' and
>username='test2'
>
>Fakt: The $u_id - Variable ist definitifly empty. Using "new_user.php3"
>the same way is no problem.
>
>I hope someone can help me.
>
>Thanks, Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>