static function resetPassword($email, $password, $rand) { require 'db.php'; $sth = $dbh->query("SELECT resetRand FROM users WHERE email='{$email}'"); $sth->setFetchMode(PDO::FETCH_OBJ); $result = $sth->fetch(); if ($result->resetRand == $rand) { require_once 'Encryption.php'; $passwordE = Encryption::encrypt($password); $newRand = LoginSystem::generateRandomNumber(); $sth = $dbh->prepare("UPDATE users SET password='******', resetRand='{$newRand}' WHERE email='{$email}'"); $sth->execute(); return '<p class="full success"><i class="ico-info"></i>Password successfully reset. Please <a href="signin">sign in</a>.' . LoginSystem::wrapEnd; } else { return LoginSystem::wrapStart . 'This link has expired. Please <a href="forgotten-password">request a new password reset link</a>.' . LoginSystem::wrapEnd; } }