md5() with rand() || Strange results, need help....
| From: | CF High | Date: | Fri, 14 May 2004 01:57:11 +0000 |
| Subject: | md5() with rand() || Strange results, need help.... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-186187@lists.php.net to get a copy of this message | ||
Hey all.
I'm running an online sport report that is member protected; i.e. users need
to login to gain site access.
When a new user signs up, I set their username to their email address &
generate a temporary password for them using rand() & md5():
$username = strip_illegals($_POST['email']);
$plain_pass = rand();
$password = md5($plain_pass);
I then insert their login info into our member's table.
Unexpectedly, when users attempt to login no matching record is found.
Their login submits two post fields (username & password):
$username = trim(strtolower($_POST['username']));
$password = trim(strtolower($_POST['password'));
$password = md5($password);
The username matches, but the password does not -- I've echoed the md5'd
submitted password & maddenlingly, it doesn't match.
I've had no problem using md5() before and am completely dumbfounded as to
why this is not working.
If anyone has any clues as to what might be happening; i.e. why the md5'd
submitted plain text password does not match the stored md5'd password,
please, please let me know.
The email complaints are piling up and I'm getting nowhere.....
--Noah
--