hjkhjkjhkhjkgjghjhgjhgjghjhghjghjhgjjnbvnvbnvk
bnmbnmbnhjkhjkhjkhjktyutyutyuytutyutyutyhgjgjghjgjghjguytutyry
/
home
/
wjcvelqp
/
public_html
/
despiteloveday.com.ng
/
Upload FileeE
HOME
<?php $page_title = 'Login'; session_start(); require_once 'config/database.php'; require_once 'includes/auth.php'; if (isCustomerLoggedIn()) { header('Location: customer/dashboard.php'); exit; } $error = ''; $redirect = $_GET['redirect'] ?? 'customer/dashboard.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $email = trim($_POST['email'] ?? ''); $password = $_POST['password'] ?? ''; $redirect = $_POST['redirect'] ?? $redirect; if (empty($email) || empty($password)) { $error = 'Please enter email and password.'; } else { $db = getDB(); if (!$db) { $error = 'Database not available. Please import config/setup.sql first.'; } else { try { $stmt = $db->prepare("SELECT id, full_name, password FROM customers WHERE email = ?"); $stmt->execute([$email]); $user = $stmt->fetch(); if ($user && password_verify($password, $user['password'])) { $_SESSION['customer_id'] = $user['id']; $_SESSION['customer_name'] = $user['full_name']; header('Location: ' . $redirect); exit; } else { $error = 'Invalid email or password.'; } } catch (Exception $e) { $error = 'Login failed. Please try again.'; } } } } include 'includes/header.php'; ?> <section class="page-hero"> <div class="container"> <h1>Customer Login</h1> <p>Login to view your bookings. You can also book as a guest without an account.</p> </div> </section> <section style="padding:60px 0;"> <div class="container" style="max-width:440px;"> <div style="background:white; border-radius:16px; box-shadow:var(--shadow); padding:40px;"> <?php if ($error): ?> <div class="alert alert-error"><?php echo htmlspecialchars($error); ?></div> <?php endif; ?> <form method="POST"> <input type="hidden" name="redirect" value="<?php echo htmlspecialchars($redirect); ?>"> <div class="form-group"> <label>Email Address</label> <input type="email" name="email" class="form-control" required autofocus value="<?php echo htmlspecialchars($_POST['email'] ?? ''); ?>"> </div> <div class="form-group"> <label>Password</label> <input type="password" name="password" class="form-control" required> </div> <button type="submit" class="btn btn-gold" style="width:100%;">Login</button> </form> <p style="text-align:center; margin-top:24px; font-size:14px; color:var(--gray-600);"> Don't have an account? <a href="register.php" style="color:var(--navy); font-weight:600;">Register</a> </p> <p style="text-align:center; margin-top:12px; font-size:13px;"> <a href="booking.php" style="color:var(--gold-dark);">Continue as Guest → Book without logging in</a> </p> </div> </div> </section> <?php include 'includes/footer.php'; ?>