34853-vm/signup.php
2025-10-11 05:03:50 +00:00

82 lines
3.1 KiB
PHP

<?php
require_once __DIR__ . '/db/config.php';
if (!isset($_GET['plan_id'])) {
header('Location: /#plans');
exit;
}
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM plans WHERE id = ? AND is_active = 1");
$stmt->execute([$_GET['plan_id']]);
$plan = $stmt->fetch();
if (!$plan) {
// Plan not found or not active
header('Location: /#plans');
exit;
}
// Page content for signup
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sign Up for <?php echo htmlspecialchars($plan['name']); ?></title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<div class="container mt-5">
<div class="row">
<div class="col-md-8 offset-md-2">
<h1 class="mb-4">Complete Your Order</h1>
<div class="card mb-4">
<div class="card-body">
<h4 class="card-title">Your Plan</h4>
<h5><?php echo htmlspecialchars($plan['name']); ?></h5>
<p class="price fs-4">$<?php echo htmlspecialchars(number_format($plan['price_monthly'], 2)); ?><span class="period">/mo</span></p>
<p><?php echo htmlspecialchars($plan['description']); ?></p>
</div>
</div>
<h4 class="mb-3">Your Details</h4>
<form id="signup-form">
<!-- User details form -->
<div class="mb-3">
<label for="name" class="form-label">Full Name</label>
<input type="text" id="name" class="form-control" required>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email Address</label>
<input type="email" id="email" class="form-control" required>
</div>
<div class="mb-3">
<label for="address" class="form-label">Service Address</label>
<input type="text" id="address" class="form-control" required>
</div>
<h4 class="mb-3 mt-4">Payment Details</h4>
<!-- Stripe Payment Element will go here -->
<div id="payment-element" class="mb-3"></div>
<!-- Used to display form errors -->
<div id="payment-message" class="hidden"></div>
<button id="submit" class="btn btn-primary btn-lg w-100">
<span id="button-text">Pay Now</span>
<span id="spinner" style="display: none;">Processing...</span>
</button>
</form>
</div>
</div>
</div>
<script src="https://js.stripe.com/v3/"></script>
<script src="assets/js/signup.js?v=<?php echo time(); ?>"></script>
</body>
</html>