hash_password无法正常工作且索引未定义

时间:2018-09-24 18:07:55

标签: php mysqli password-hash

我正在尝试使用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>';  
          }
       }
      } 
      ?>  

我相信插入是可以的,有什么想法吗?

0 个答案:

没有答案