} if (empty($_POST["password"])) { $_SESSION["form_errors"] = true; $_SESSION["password_error"] = "A password is required"; $_SESSION["email"] = $email; } else { $password = $pass->crypt_pass($_POST['password']); } if ($_SESSION["password_error"] === "") { $user = $dao->getUser($email); if (is_null($user["email"])) { $_SESSION["form_errors"] = true; $_SESSION["email_error"] = "Account not found"; $_SESSION["email"] = $email; } else { if ($pass->is_password_correct($user, "{$password}")) { $_SESSION["name"] = $user["first"]; $_SESSION["email"] = $email; $_SESSION["user_id"] = $user["id"]; } else { $_SESSION["form_errors"] = true; $_SESSION["password_error"] = "Invalid password"; $_SESSION["email"] = $email; } } } ?> <!doctype html> <html lang="en"> <head>