Hi there, I'm new here.
I haven't been using PHP too long and have basically learned from code thats already out there online. I am however, currently having an issue with a login script and the MD5 encryption format.
The current login system is a simple form with a textbox in which you enter a password. The password has been stored in a database on its own in MD5 format. When the form is submitted the value in the textbox is transformed into MD5 encryption and compared to the stored password.
When the return was not a match (despite entering the same password as in the database) I echo'd the inputted password to see what result it was giving. What is happening is there is an extra character being added onto the end of the value given in the textbox.
For example, I used a password of 'test' to insert into the database. This is how it is shown in the db in MD5: 098f6bcd4621d373cade4e832
And then when I enter 'test' into the text box it is shown as 098f6bcd4621d373cade4e832627b4f6.
Compared:
098f6bcd4621d373cade4e832
098f6bcd4621d373cade4e832627b4f6
They are the same for the first 25 chars, however the one entered into the textbox has some extra added on the end.
To see if it was there same character/chars being added to the end of the string each time I used another test password as shown below and the extra part is different to the one above.
New password test:
1610838743cc90e3e4fdda748
1610838743cc90e3e4fdda748282d9b8
I also made sure there wasnt a space being added accidently or anything like that also.
I know there are functions such as addslashes and magic quotes which I have tried using but since I will not be using any special characters for this password these should not be needed anyway. I am also aware that just MD5 encryption is not so secure, however this problem is really annoying me.
I have been able to use the login without MD5 encryption which is even less secure.
If I need to put up the code for changing the password (updating it in the database) and my logincheck code then I shall do, however someone might be aware what a possible cause is for this.
Thanks for taking your time to read this and any help is much appreciated.