note 121974 added to function.password-verify
| From: | omidbahrami1990 at gmail dot com | Date: | Mon, 04 Dec 2017 22:03:28 +0000 |
| Subject: | note 121974 added to function.password-verify | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209309@lists.php.net to get a copy of this message | ||
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);
// $_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
?>
----
Server IP: 208.43.231.9
Probable Submitter: 128.199.193.75
----
Manual Page -- http://php.net/manual/en/function.password-verify.php
Edit -- https://master.php.net/note/edit/121974
Del: integrated -- https://master.php.net/note/delete/121974/integrated
Del: useless -- https://master.php.net/note/delete/121974/useless
Del: bad code -- https://master.php.net/note/delete/121974/bad+code
Del: spam -- https://master.php.net/note/delete/121974/spam
Del: non-english -- https://master.php.net/note/delete/121974/non-english
Del: in docs -- https://master.php.net/note/delete/121974/in+docs
Del: other reasons-- https://master.php.net/note/delete/121974
Reject -- https://master.php.net/note/reject/121974
Search -- https://master.php.net/manage/user-notes.php