Crypto.HashPassword in php
// To hash the password, use
password_hash("MySuperSafePassword!", PASSWORD_DEFAULT)
// To compare hash with plain text, use
password_verify("MySuperSafePassword!", $hashed_password)/* Include the database connection script. */
include 'pdo.php';
/* ID of the account to edit. */
$accountId = 1;
/* Update query template. */
$query = 'UPDATE accounts SET account_passwd = :passwd WHERE account_id = :id';
/* Values array for PDO. */
$values = [':passwd' => $hash, ':id' => $accountId];
/* Execute the query. */
try
{
$res = $pdo->prepare($query);
$res->execute($values);
}
catch (PDOException $e)
{
/* Query error. */
echo 'Query error.';
die();
}
Also in PHP:
- Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0". when php is 7.4
- exceptional handling in php
- How do you clear cache in Laravel?
- calculate total time from start and end datetime in php
- date format function in php
- eloquent get query log
- date() php - 1day
- count length of string in php
- composer get php version
- Laravel 7 do not see my new added seeder
- .catch php
- clear all caches in laravel
- check if substr in string php
- check if the string match in php
- clear laravel 5 cache\
- create foreign key laravel migration
- array shift php
- How can I install php7.4 on Ubuntu 18.04?
- date in php in dats
- new project installation in laravel
- array has key php
- Warning: get_browser(): browscap ini directive not set in
- define header in different file php
- Codeigniter count query results