PHP & MYSQL password_verify issue -


basically. having problem decrypting passwords.this dummy project , done in mysql (i understand depreciated, learning mysqli & pdo currently).

i can hash password perfectly, so:

$password = password_hash("$password1", password_default);     $password = substr( $hash, 0, 60 ); 

my database password field set char(255) stumped.. have password_verify running so:

// define $username , $password    if (isset($_post["action"]) && $_post["action"]=="login")     {     $username =$_post["username"];     $password =$_post["password"];  // sql query fetch information of registered users , finds user match. //searches table username , password matching post data      $dbquery = "select * users username = '$username';";     $dbresult = mysql_query($dbquery);     $dbrow=mysql_fetch_array($dbresult);      $username = $dbrow["username"];  // checks if user exists sql     if(mysql_num_rows($dbresult)==0)     {         echo '<script language="javascript">';         echo 'alert("oops! no user exists under username!")';         echo '</script>';     }      $hash = $dbrow['password'];     // checks if password matches stored hash      if (password_verify('$password', $hash)) {     echo 'password valid!'; } else {     echo 'password valid!'; }    } 

any appreciated! thanks


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -