id)) { http_response_code(303); header("Location: /"); die(); } $description = "Log in to access your account."; $title = "Login"; if ($_SERVER["REQUEST_METHOD"] === "POST"): ?> prepare("SELECT * FROM members WHERE LOWER(email) = LOWER(:email)"); $results = $stmt->execute([ "email" => $_POST["email"], ]); $account = $stmt->fetch(PDO::FETCH_OBJ); if (!$account) { http_response_code(401); } elseif (password_check($account)) { $_SESSION["account"] = $account; http_response_code(303); header("Location: " . $_POST["redirect"] ?? "/"); die(); } endif; include "partials/head.php"; ?>