diff --git a/auth.php b/auth.php index 9ee67b2..f2b6809 100644 --- a/auth.php +++ b/auth.php @@ -12,13 +12,13 @@ define("OPTIONS_PASSWORD", array( )); function checkPasswordFormat($password) { - if (preg_match("/" . PASSWORD_REGEX . "/", $password) !== true) - userError("Password malformed.") + if (preg_match("/" . PASSWORD_REGEX . "/", $password) !== 1) + userError("Password malformed."); } function checkUsernameFormat($username) { - if (preg_match("/" . USERNAME_REGEX . "/", $username) !== true) - userError("Username malformed.") + if (preg_match("/" . USERNAME_REGEX . "/", $username) !== 1) + userError("Username malformed."); } function hashPassword($password) { @@ -35,15 +35,9 @@ function userExist($username) { $data = $op->fetch(); if (isset($data['username'])) - $dbUsername = $data['username']; - else - $dbUsername = NULL; - - if (isset($dbUsername)) { return true; - } else { + else return false; - } } function checkPassword($username, $password) {