谢谢你在这个问题上的帮助。我试图将密码与php password_verify进行比较,但它不起作用。我的代码有问题吗?(我得到第二条消息"无效的用户或密码")干杯!
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(); }
谢谢大家的帮助!问题出在DB列的长度上,它不够长,不能进行哈希。谢谢你!