Page 1 of 1

Problem with login scripts

Posted: Fri May 04, 2007 9:26 pm
by dhossai
Hi fellows!
I hope some one would be able to help me here. I have a forgot password script that automatically generate the password and mail it back to user if user put his email address and it create the password in md5 format and successfully update the database password filed. Now my problem is the login scripts i have it does not work. The password that mailed out to user does not work. But if I copy the whole password filed and use that to log in it works. I believe it is my login scripts that is not coverting the plaintext to md5 format. Here is my login scripts part....

*** PLEASE USE THE

Code: Select all

TAG WHEN POSTING CODE ***[/color]

Code: Select all

$userid=mysql_real_escape_string($userid); 
$password=mysql_real_escape_string($password); 

if($rec=mysql_fetch_array(mysql_query("SELECT * FROM tbl_login WHERE userid='$userid' AND password = '$password'"))){ 
    if(($rec['userid']==$userid)&&($rec['password']==$password)){ 
     include "include/newsession.php";
Can some one tell me what would be the code for md5 format for this scripts.

Posted: Fri May 04, 2007 11:20 pm
by Z3RO21
use the md5() function on your password before submitting it

Posted: Sat May 05, 2007 9:16 pm
by dhossai
Thanks Z, it woked fine.