prepare("SELECT COUNT(*) FROM verify_email_keys WHERE token = :t"); $tokencheck->bindParam(":t", $hash, PDO::PARAM_STR); $tokencheck->execute(); } while ($tokencheck->fetchColumn() != 0); return $hash; } public static function GenerateResetPasswordHash(int $len) { $hash = ""; do { $hash = HashingUtiltity::GenerateByteHash($len); $tokencheck = $GLOBALS['pdo']->prepare("SELECT COUNT(*) FROM password_reset_keys WHERE token = :t"); $tokencheck->bindParam(":t", $hash, PDO::PARAM_STR); $tokencheck->execute(); } while ($tokencheck->fetchColumn() != 0); return $hash; } public static function IsEmailRegistered(string $email) { $check = $GLOBALS['pdo']->prepare("SELECT COUNT(*) FROM users WHERE email = :e"); $check->bindParam(":e", $email, PDO::PARAM_STR); $check->execute(); if ($check->fetchColumn() > 0) { return true; } return false; } } }