更新时间:2023-02-26 17:56:24
一般做法如下:
password
哈希,其中 username
= 输入的用户名.password
hash from the database where the username
= the inputted username.我将在此处用一些伪代码为您概述上述流程:
I'll outline the above flow in some pseudo code for you here:
$query = SELECT password FROM users WHERE username = '$username'
$data = FETCH_THE_DATA($query);
if(password_verify($USER_INPUTTED_PASSWORD, $data['password'])) {
// password is correct
} else {
// password is in-correct
}
注意事项
mysql_*
函数.该库已被弃用,因为它不可靠,并将在 PHP 的未来版本中删除.mysql_*
functions. The library is deprecated as it's unreliable and will be removed in future releases of PHP.