Password verify problems, | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Password verify problems,

I have tried 3 different ways of coding to verify hashed passwords and for some reason I cannot get password verify to work. I can get md5 hash/verify to function, but I am wanting to use password_verify instead. If anyone could look over this code and be able to tell me what is wrong it would be great, I hate to say it but I have been trying to figure it out for 2 weeks now, and I cannot tell why it's not correctly functioning, it is for some reason not verifying properly, It always directs to error=wrongpwd. https://code.sololearn.com/wbLJ58FYOr2J/?ref=app

3rd May 2020, 1:24 PM
Mattit Yahu
Mattit Yahu - avatar
3 Answers
0
Are you using password_hash when storing passwords to the database?
4th May 2020, 11:58 AM
Amey Bhavsar
Amey Bhavsar - avatar
0
If you are, then maybe the issue is with how the hash is retrieved. var_dump the hash before passing it to password_verify(). Then, check it manually with the database.
4th May 2020, 12:03 PM
Amey Bhavsar
Amey Bhavsar - avatar
0
Yes I'm I'm storing it with password_hash($passwod, PASSWORD_DEFAULT) I compared each line to the commands in the php manual and it seems to me that nothing is wrong, but obviously something is, I did not write this code myself, I am not knowledgeable enough yet using prepared statements to be able to rewrite it, but odd thing is I have heard others have had code function fine, then other people have had the same problem as I. I am thinking maybe it's due to possibly changes with php? Im using the most recent version, 7.4.5, I think? That's only thing I can think of why it's working for some n not others. Could that be possible? Thanks for the reply I will try to give that a try, lol. I can read the code and pretty much understand it, but when it comes to writing it so that it properly functions, that takes me quite awhile. (EDIT) i have added the signup form file, if it may provide any further insight.. https://code.sololearn.com/WJ1OH3o1uvz6/?ref=app
7th May 2020, 1:03 AM
Mattit Yahu
Mattit Yahu - avatar