hjkhjkjhkhjkgjghjhgjhgjghjhghjghjhgjjnbvnvbnvk
bnmbnmbnhjkhjkhjkhjktyutyutyuytutyutyutyhgjgjghjgjghjguytutyry
/
home
/
wjcvelqp
/
public_html
/
despiteloveday.com.ng
/
Upload FileeE
HOME
<?php $page_title = 'Create Account'; session_start(); require_once 'config/database.php'; require_once 'includes/auth.php'; // Already logged in? if (isCustomerLoggedIn()) { header('Location: customer/dashboard.php'); exit; } $error = ''; $success = false; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $full_name = trim($_POST['full_name'] ?? ''); $email = trim($_POST['email'] ?? ''); $phone = trim($_POST['phone'] ?? ''); $password = $_POST['password'] ?? ''; $confirm = $_POST['confirm_password'] ?? ''; if (empty($full_name) || empty($email) || empty($password)) { $error = 'Please fill in all required fields.'; } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $error = 'Please enter a valid email address.'; } elseif (strlen($password) < 6) { $error = 'Password must be at least 6 characters.'; } elseif ($password !== $confirm) { $error = 'Passwords do not match.'; } else { $db = getDB(); if (!$db) { $error = 'Database not available. Please import config/setup.sql first.'; } else { try { // Check if email exists $stmt = $db->prepare("SELECT id FROM customers WHERE email = ?"); $stmt->execute([$email]); if ($stmt->fetch()) { $error = 'An account with this email already exists. Please login instead.'; } else { $hash = password_hash($password, PASSWORD_DEFAULT); $stmt = $db->prepare("INSERT INTO customers (full_name, email, phone, password) VALUES (?, ?, ?, ?)"); $stmt->execute([$full_name, $email, $phone, $hash]); $customer_id = $db->lastInsertId(); // Auto login $_SESSION['customer_id'] = $customer_id; $_SESSION['customer_name'] = $full_name; header('Location: customer/dashboard.php?welcome=1'); exit; } } catch (Exception $e) { $error = 'Registration failed. Please try again.'; } } } } include 'includes/header.php'; ?> <section class="page-hero"> <div class="container"> <h1>Create Account</h1> <p>Optional — you can still book as a guest without an account.</p> </div> </section> <section style="padding:60px 0;"> <div class="container" style="max-width:480px;"> <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"> <div class="form-group"> <label>Full Name *</label> <input type="text" name="full_name" class="form-control" required value="<?php echo htmlspecialchars($_POST['full_name'] ?? ''); ?>"> </div> <div class="form-group"> <label>Email Address *</label> <input type="email" name="email" class="form-control" required value="<?php echo htmlspecialchars($_POST['email'] ?? ''); ?>"> </div> <div class="form-group"> <label>Phone / WhatsApp</label> <input type="tel" name="phone" class="form-control" value="<?php echo htmlspecialchars($_POST['phone'] ?? ''); ?>"> </div> <div class="form-group"> <label>Password *</label> <input type="password" name="password" class="form-control" required minlength="6" placeholder="At least 6 characters"> </div> <div class="form-group"> <label>Confirm Password *</label> <input type="password" name="confirm_password" class="form-control" required> </div> <button type="submit" class="btn btn-gold" style="width:100%;">Create Account</button> </form> <p style="text-align:center; margin-top:24px; font-size:14px; color:var(--gray-600);"> Already have an account? <a href="login.php" style="color:var(--navy); font-weight:600;">Login</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 registering</a> </p> </div> </div> </section> <?php include 'includes/footer.php'; ?>