This Is The Most Secure Way To Keep Your Password Safe With PHP 7 ,
Even When Your DataBase Has Been Hacked ,
It Will Be Almost Impossible To Retrieve Your Password .
--------------------------------------------------------
--- When A User Wants To Sign Up ---
1 ---> Get Input From User Which Is The User`s Password
1 ---> Hash The Password
2 ---> Store The Hashed Password In Your DataBase
--------------------------------------------------------
<?php
$hashed_password = password_hash($_POST["password"],PASSWORD_DEFAULT);
?>
--------------------------------------------------------
--- 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";
?>