php - password_verify function is not working -
i trying use password_verify
in php compare hashed password in database user input put doesn't work.
this code :
if (isset($_post['login'])){ $usrname = $_post['uname']; $usrpass = $_post['password']; $_session['usr'] = $usrname; $sql = "select * users usrname = '".$usrname."'"; $result = mysql_query($sql); if (!$result)die('invalid query: ' . mysql_error()); else{ while($row = mysql_fetch_array($result)) {$pass=$row[2];} } $verify=password_verify($usrpass,$pass); if($verify){ echo("<script>location.href = 'index.php';</script>"); } else { echo "<h1>{user , password combination doesn't exist}</h1>"; } }
Comments
Post a Comment