Ezilon.com - Target Your Audience, be Seen in Your Region

md5() problem

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

He has: 107 posts

Joined: Mar 2006

Hi,

I can use md5($password) to encrypt passwords, but can't seem to get it to work for when the user wants to log in.

For example,

// Encrypt password
$passwordmd5 = md5($password);

So when the user enters their password to login, I use the same code as above to encrypt the password they entered to check it against the encrypted password in the database, but it doesn't work. Why is this?

He has: 107 posts

Joined: Mar 2006

I found out why it didn't work, it was because the password field in the database was 10 characters which meant it didn't store the 32 characters of the encrypted password. I changed it to 32 characters and it worked.