Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialerk erkk
219 PointsHello i writing a login and signup script in php. however if I hash password in signup file how do i put in password
How to make password match for example password @asd@ hashed in database, and when i write @asd@ again in login form it not matches 60 var char hash in database how do i do to make it work>>?
1 Answer
Erasto Oraro
5,610 Points// You can use password_verify function to match the password in database. $password is the real password in login form
<?php $password= "ABC7788"; $db_hashedpassword = "@asd@ ";
if (password_verify($password, $db_hashedpassword )) { echo "Correct password"; } else { echo "Incorrect password"; } ?>