Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User
- {
- public static function checkUser($password, $passwordDb, $username)
- {
- global $dbh;
- if (substr($passwordDb, 0, 1) == "$")
- {
- if (password_verify($password, $passwordDb))
- {
- return true;
- }
- return false;
- }
- else
- {
- $passwordBcrypt = self::hashed($password);
- if (md5($password) == $passwordDb)
- {
- $stmt = $dbh->prepare("UPDATE users SET password = :password WHERE username = :username");
- $stmt->bindParam(':username', $username);
- $stmt->bindParam(':password', $passwordBcrypt);
- $stmt->execute();
- return true;
- }
- return false;
- }
- }
Add Comment
Please, Sign In to add comment