MD5 troubles...

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
dwfait
Forum Contributor
Posts: 113
Joined: Sun Aug 01, 2004 10:36 pm

MD5 troubles...

Post by dwfait »

Hi. Ill post my code and then explain whats wrong.

Code: Select all

$mpass=MD5("$pass");

mysql_query("INSERT INTO sspp SET id='',user='$user',pass='$mpass',fname='$fname',lname='$lname',nname='$nname',staff='No',email='$email'");
Now, whatever $pass is, the MD5 value of it always comes out in the database as:
b148e7f41fdc3be4b14e8d17e068bbad

Can anyone help or do i need to post more code?
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

$mpass=MD5($pass);
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

are you sure $pass is actually set? is register_globals on?
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Im pretty sure he/she does. After calculating the string $pass through an md5 calculator I was resulted with the exact md5 hash which was given. I am also pretty sure that anything placed in between quotes of the md5 function is treated as an individual string. Perhaps im wrong!
dwfait
Forum Contributor
Posts: 113
Joined: Sun Aug 01, 2004 10:36 pm

Post by dwfait »

Hi, thanks joe, it worked :)
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

no problem :)
Post Reply