我正在尝试使用hash_password进入会话,但是它使我始终返回“ else”语句,并且在密码验证行中还返回了未定义的索引$ senha。
<?php
$codigo = mysqli_real_escape_string($conexao, $_POST['codigo']);
$senha = mysqli_real_escape_string($conexao, $_POST['senha']);
$sql = "SELECT * FROM esc_usuarios WHERE usu_codigo = '$codigo'";
$result = mysqli_query($conexao, $sql);
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{
if(password_verify($senha, $row['senha']))
{
$_SESSION['codigo']=$codigo;
header("location:entry.php");
}
else
{
echo '<script>alert("Wrong User Details")</script>';
}
}
}
?>
我相信插入是可以的,有什么想法吗?