Skip to main content
Inspiring
April 1, 2011
Question

Using Login script to Check against MD5 password.

  • April 1, 2011
  • 1 reply
  • 1669 views

I am building a user portal system and I want to 'beef' up the security.  I created a registration system that has a user verification email tool working great.  The registration form also encrypts the user password using MD5 encryption.

I have setup my password column in the table to accept 32 characters.

I have also seen previous posts that mention to use the following code in the login script:

if(isset($_POST['password'])) {
    $_POST['password'] = md5($_POST['password']);
    }

I have set all that up, but still cannot get the login system to work.  It does work, when i remove the code above, and use my login usernames that are not setup as MD5.

From what I can tell, I need to have the login script check the $_POST['password'] against the MD5 password in the DB but cannot figure out how to do that.  Any suggestions are greatly appreciated.

This topic has been closed for replies.

1 reply

Inspiring
April 1, 2011

Forgive me.

I found my error.

On my confirm page, i was checking for the random confirm code i generated in the email.

I then took the users information tied to that code and moved it to my general users table.

PROBLEM: i added the code to add their password into the users table as md5 as well.  so the users password was being converted by md5 into the temp users table, then converted again into the general users table.

I removed the code from the confirm record insert and it works great now.

For the record, the dreamweaver code that needs to be adjusted is simply:

original

if (isset($_POST['username'])) {
  $loginUsername=$_POST['username'];
  $password=$_POST['password'];

new

if (isset($_POST['username'])) {
  $loginUsername=$_POST['username'];
  $password=md5($_POST['password']);