Problem with login scripts

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dhossai
Forum Newbie
Posts: 6
Joined: Mon Apr 30, 2007 6:07 pm

Problem with login scripts

Post 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.
Z3RO21
Forum Contributor
Posts: 130
Joined: Thu Aug 17, 2006 8:59 am

Post by Z3RO21 »

use the md5() function on your password before submitting it
dhossai
Forum Newbie
Posts: 6
Joined: Mon Apr 30, 2007 6:07 pm

Post by dhossai »

Thanks Z, it woked fine.
Post Reply