prepare($sql); $stmt->execute([$email]); $user = $stmt->fetch(); if ($user && password_verify($password, $user['password'])) { $_SESSION['user_id'] = $user['id']; $_SESSION['user_name'] = $user['name']; header('Location: index.php'); exit; } else { $error = 'Invalid email or password.'; } } catch (PDOException $e) { $error = 'Database error: ' . $e->getMessage(); } } } ?> Login - Sacred Habits

Login to Your Account