![]() ![]() ![]() If you're on PHP 5.5 or later, there's the built-in password_hash() and password_verify() with Bcrypt - if you're on PHP 5.3.7 or later, there's the password_compat compatibility library all this is per the PHP.net Safe Password Hashing FAQ entry.Įssentially, on PHP 5.3.7 and above, replace the old crypt() with password_hash() and password_verify(). $row = $statement->fetch(PDO::FETCH_ASSOC) $statement->bindValue(':username',$username,PDO::PARAM_STR) Save password in DB prepare("INSERT INTO table_name (name,pass) VALUES (:name,:pass)") Here is an example script (save and login) using PDO. Instead of using SHA family methods, you can use the crypt() function to salt it for you. ![]()
0 Comments
Leave a Reply. |