php - What's wrong with my login script using PDO? -


I am using PDO and the login script is not working?
The main reason is that password_verify will not match the actual password.

  & lt ;? Php session_start (); Include 'conn.php'; If (isset ($ _ POST) & amp; Count ($ _ POST)> 0) {$ user = $ _POST ['user']; $ Pass = $ _POST ['pass']; $ Option = array ('value' = & gt; 12); $ Hash = password_hash ($ pass, PASSWORD_BCRYPT, $ option); $ Secure = password_verify ($ pass, $ hash); // $ secure = hash ('sha512', $ pass); $ Query = "SELECT * signup user name =: user and password =: pass"; $ Result = $ conn- & gt; Ready ($ query); $ Result-> Execute (array (': user' = & gt; $ user, ': pass' = & gt; $ secure)); $ Race = $ result-> FetchColumn (); If ($ res> 0) {// Username Session session $ $ _SESSION ['user'] = $ set user; // Go to secure page header ('location: index.php'); } // AndIf other {header ('location: signin.php'); }}? & Gt;  

If I use the hash ("algo, $ var) then the script gets rectified, but this is not working using standard php 5.5 technology Is doing. P>

Confirm the password returns a boolean. You are currently matching the supply to $

  ': pass' = & gt; $ secure  

should be P>

  ': pass' = & gt; $ hash  

you password_verify Need to use Is not.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -