PHP Login using Hashed Password | password_verify

preview_player
Показать описание
In this php video tutorial, You will be able to login with hashed password.

Please check this sign up tutorial, where I have shown you how to save your password in hash in database :

Steps:
Firstly create your login form
Submit the login form with method post
Create the same function in controller
After that in that function, check for validation using form validation library in CodeIgniter
Set rules for email and password -
email -required and valid_email
password - required and min_length

Run the form validation
if true
then check password verify
else
load the login page again

for password verification
password_verify() takes two argument
password - pass paswword from your form in string format
hash - hashed password that is stored using password_hash in your database

Verifies that the given hash matches the given password.

Note that password_hash() returns the algorithm, cost and salt as part of the returned hash. Therefore, all information that's needed to verify the hash is included in it. This allows the verify function to verify the hash without needing separate storage for the salt or algorithm information.

This function is safe against timing attacks.

Returns true if the password and hash match, or false otherwise.

Check the document

Code link:

#php #codeigniter #knowledgethrusters
Рекомендации по теме
Комментарии
Автор

clear and easy explanation, well done👍

aashutoshyadav
Автор

Thank you so much for sharing your knowledge :)

ckobajp
Автор

Can you please explain that with another method of select like SELECT * FROM employees WHERE email = $_POST['email'] and so on... please

VFRodriguez