Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Trouble in PHParadise


  • Please log in to reply

#1
TheWern

TheWern

    Member

  • Member
  • PipPip
  • 82 posts
Hi All,

Well I'm setting up my first database with username and password access to members area.
The problem I am having is that the md5 result from the registration form password doen't match the md5'd result of the logon form password - given that I am entering the same password.

using this code for the registration form / database table insertion:-
print ('before md5 ' . $arVals['ppassword']);
$arVals['ppassword'] = "'".md5($arVals['ppassword'])."'";
print (' after md5 ' . $arVals['ppassword']);

SHows a result of:- before md5 'dddd' after md5 'b7ac20233cf6b55bde4d324323b17abb'

However, in the same page of code:-
$inputdata = ('dddd');
$result = md5($inputdata);
print (' mdfive test ' . $result);

SHows a result of:- mdfive test 11ddbaf3386aea1f2974eee984542152

This is consistent with the result of the code I have used for entering the users password.
I dont understand why they should be different or how I can get arround this.

It may be helpful to convert back from md5 to original so I can see which one is the incorrect result for 4 d's entered as a password.

THANX
  • 0

Advertisements


#2
TheWern

TheWern

    Member

  • Topic Starter
  • Member
  • PipPip
  • 82 posts
I have managed to sort it out....

it was all about the "'" 's. The md5 included them in the array before conversion, but not on the $_post from the login page.

Thanks anyway...
  • 0

#3
Michael

Michael

    Retired Staff

  • Retired Staff
  • 1,869 posts

It may be helpful to convert back from md5 to original


Just as a note, that is very, very hard to do.

Yes, md5 will change the result hugely if you include an extra character.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP