Password Verify PHP
Password Verify
This Is The Most Secure Way To Keep Your Password Safe With PHP .
Even If Your DataBase Has Been Hacked .
It Is Almost Impossible To Retrieve Your Password .
When A User Wants To Sign Up :
1 – Get Input From User Which Is The User`s Password .
2 – Hash The Password .
3 – Store The Hashed Password In Your DataBase .
<?php
$hashed_password = password_hash($_POST["password"],PASSWORD_DEFAULT);
// $_POST["password"] ---> Is The User`s Input
// $hashed_password ---> Is The Hashed Password You Can Store In Your DataBase
?>
When A User Wants To Sign In :
1 – Get Input From User Which Is The User`s Password .
2 – Fetch The Hashed Password From Your Database .
3 – Compare The User`s Input And The Hashed Password .
<?php
if(password_verify($_POST["password"],$hashed_password))
echo "Welcome";
else
echo "Wrong Password";
// $_POST["password"] ---> Is The User`s Input
// $hashed_password ---> Is The Hashed Password You Have Fetched From DataBase
?>