Password_verify bcrypt 不工作
Password_verify bcrypt not working
感谢您帮我解答这个问题。我正在尝试将密码与 php password_verify 进行比较,但它不起作用。我的代码有问题吗? (我收到第二条消息'INVALID USER OR PASSWORD')干杯!
function login_aut($uname, $pass){
include('_con.php');
include('password.php');
$stmt = $conex->prepare("SELECT id, pass FROM tb_users WHERE uname =?");
/* bind parameters for markers */
$stmt->bind_param("s", $uname);
/* execute query */
$stmt->execute();
/* get num of rows */
$stmt->store_result();
$numrows = $stmt->num_rows;
if(($numrows) == ""){echo 'INVALID USER ';die();}
$stmt->bind_result($u_id,$upass);
$stmt->fetch();
/* close statement */
$stmt->close();
if (!password_verify($pass,$upass)) { echo 'INVALID USER OR PASSWORD'; die(); }
感谢大家的帮助!问题出在数据库列的长度上,它对于哈希来说不够长。谢谢!
感谢您帮我解答这个问题。我正在尝试将密码与 php password_verify 进行比较,但它不起作用。我的代码有问题吗? (我收到第二条消息'INVALID USER OR PASSWORD')干杯!
function login_aut($uname, $pass){
include('_con.php');
include('password.php');
$stmt = $conex->prepare("SELECT id, pass FROM tb_users WHERE uname =?");
/* bind parameters for markers */
$stmt->bind_param("s", $uname);
/* execute query */
$stmt->execute();
/* get num of rows */
$stmt->store_result();
$numrows = $stmt->num_rows;
if(($numrows) == ""){echo 'INVALID USER ';die();}
$stmt->bind_result($u_id,$upass);
$stmt->fetch();
/* close statement */
$stmt->close();
if (!password_verify($pass,$upass)) { echo 'INVALID USER OR PASSWORD'; die(); }
感谢大家的帮助!问题出在数据库列的长度上,它对于哈希来说不够长。谢谢!