mysqli - Misunderstanding with password verifying php -


im trying verify user's login , compare 2 passwords (they hashed in database). im pretty sure stupid mistake or error can't find. how hash when saving db. $password = password_hash($_post["password"], password_bcrypt); , login method:

if(isset($_post['login'])){              $stmt = $mysqli->prepare("select `password` users username=?");             $stmt->bind_param("s", $username);              $username = $_post["username"];             $password = $_post["password"];              $stmt->execute();             $stmt->bind_result($result);              if(password_verify($password, $result)){                 header("location: http://localhost/test2/home.php");             }             else{                 echo "<script type='text/javascript'>alert('something went wrong!')</script>";                 echo $mysqli->error;                 echo $stmt->error;             }         }    

for testing purposes im trying echo errors, doesn't display anything.

forget fetch data form query result

$stmt->execute();// execute query $stmt->bind_result($result);// bind result     while ($stmt->fetch()) {// fetch data         $pass = $result;     }     if (password_verify($password, $pass)) {         header("location: http://localhost/test2/home.php");     } 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -