Fixed W12
This commit is contained in:
parent
ee0715c3b2
commit
8680f03b91
19 changed files with 444 additions and 253 deletions
|
|
@ -2,9 +2,9 @@
|
|||
// simple database PDO utilizing the Postgres driver
|
||||
class Database {
|
||||
private static $db;
|
||||
private static $dsn = 'pgsql:host=localhost;port=5432;dbname=w12';
|
||||
private static $username = 'postgres';
|
||||
private static $password = 'asarch6122';
|
||||
private static $dsn = 'pgsql:host=localhost;port=9001;dbname=db';
|
||||
private static $username = 'db';
|
||||
private static $password = 'postgres';
|
||||
private static $options = [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
|
|
@ -56,11 +56,11 @@ class Database {
|
|||
}
|
||||
|
||||
public static function generateUserNewPassword($login) {
|
||||
$password = bin2hex(random_bytes(8));
|
||||
$db = self::getDB();
|
||||
$query = $db->prepare('UPDATE users SET password = :password WHERE login = :login');
|
||||
$query->bindParam(':login', $login);
|
||||
$query->bindParam(':password', $password);
|
||||
$password = bin2hex(random_bytes(8));
|
||||
$query->execute();
|
||||
return $password;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue