diff --git a/assets/pasted-20251017-105229-1478f697.jpg b/assets/pasted-20251017-105229-1478f697.jpg
new file mode 100644
index 0000000..df5d924
Binary files /dev/null and b/assets/pasted-20251017-105229-1478f697.jpg differ
diff --git a/assets/vm-shot-2025-10-17T10-52-25-776Z.jpg b/assets/vm-shot-2025-10-17T10-52-25-776Z.jpg
new file mode 100644
index 0000000..df5d924
Binary files /dev/null and b/assets/vm-shot-2025-10-17T10-52-25-776Z.jpg differ
diff --git a/index.php b/index.php
index b27ddd1..9494aa3 100644
--- a/index.php
+++ b/index.php
@@ -184,7 +184,7 @@
-
+
SCHEDULE
diff --git a/register.php b/register.php
index 8602cc3..9a4e572 100644
--- a/register.php
+++ b/register.php
@@ -1,12 +1,11 @@
prepare("SELECT id, title, description, scheduled_at, presenter FROM webinars WHERE id = ?");
$stmt->execute([$id]);
@@ -17,15 +16,23 @@ function get_webinar_details($id) {
}
}
-// --- AJAX FORM SUBMISSION (POST REQUEST) ---
+$webinar_id = filter_input(INPUT_GET, 'webinar_id', FILTER_VALIDATE_INT) ?: filter_input(INPUT_POST, 'webinar_id', FILTER_VALIDATE_INT) ?: 1;
+$webinar = get_webinar_details($webinar_id);
+
+if (!$webinar) {
+ http_response_code(404);
+ echo "Webinar not found.";
+ exit;
+}
+
+$error_message = null;
+$success_message = null;
+$form_data = $_SESSION['form_data'] ?? [];
+unset($_SESSION['form_data']);
+
+// --- FORM SUBMISSION (POST REQUEST) ---
if ($_SERVER["REQUEST_METHOD"] == "POST") {
- header('Content-Type: application/json');
- $response = [];
-
// --- DATA CAPTURE ---
- $webinar_id = filter_input(INPUT_POST, 'webinar_id', FILTER_VALIDATE_INT) ?: filter_input(INPUT_GET, 'webinar_id', FILTER_VALIDATE_INT) ?: 1;
- $webinar = get_webinar_details($webinar_id);
-
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$first_name = filter_input(INPUT_POST, 'first_name', FILTER_SANITIZE_STRING);
$last_name = filter_input(INPUT_POST, 'last_name', FILTER_SANITIZE_STRING);
@@ -35,34 +42,25 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$confirm_password = filter_input(INPUT_POST, 'confirm_password', FILTER_UNSAFE_RAW);
$timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING);
- // Tracking data
- $utm_source = filter_input(INPUT_POST, 'utm_source', FILTER_SANITIZE_STRING);
- $utm_medium = filter_input(INPUT_POST, 'utm_medium', FILTER_SANITIZE_STRING);
- $utm_campaign = filter_input(INPUT_POST, 'utm_campaign', FILTER_SANITIZE_STRING);
- $utm_term = filter_input(INPUT_POST, 'utm_term', FILTER_SANITIZE_STRING);
- $utm_content = filter_input(INPUT_POST, 'utm_content', FILTER_SANITIZE_STRING);
- $referrer = filter_input(INPUT_POST, 'referrer', FILTER_SANITIZE_STRING);
- $gclid = filter_input(INPUT_POST, 'gclid', FILTER_SANITIZE_STRING);
- $fbclid = filter_input(INPUT_POST, 'fbclid', FILTER_SANITIZE_STRING);
+ // Store form data in session to repopulate on error
+ $_SESSION['form_data'] = $_POST;
- if (!$webinar) {
- $response = ['success' => false, 'error' => 'Webinar not found. Tried to find webinar with ID: ' . $webinar_id];
- } elseif (!$first_name || !$last_name || !$email) {
- $response = ['success' => false, 'error' => 'Please fill out all required fields.'];
+ if (!$first_name || !$last_name || !$email) {
+ $error_message = 'Please fill out all required fields.';
} elseif ($password !== $confirm_password) {
- $response = ['success' => false, 'error' => 'Passwords do not match.'];
+ $error_message = 'Passwords do not match.';
} else {
try {
$stmt = db()->prepare("SELECT id FROM attendees WHERE webinar_id = ? AND email = ?");
$stmt->execute([$webinar_id, $email]);
if ($stmt->fetch()) {
- $response = ['success' => false, 'error' => 'You are already registered for this webinar.'];
+ $error_message = 'You are already registered for this webinar.';
} else {
$password_hash = password_hash($password, PASSWORD_DEFAULT);
- $sql = "INSERT INTO attendees (webinar_id, first_name, last_name, email, company, how_did_you_hear, password, timezone, utm_source, utm_medium, utm_campaign, utm_term, utm_content, referrer, gclid, fbclid)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ $sql = "INSERT INTO attendees (webinar_id, first_name, last_name, email, company, how_did_you_hear, password, timezone)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = db()->prepare($sql);
- $stmt->execute([$webinar_id, $first_name, $last_name, $email, $company, $how_did_you_hear, $password_hash, $timezone, $utm_source, $utm_medium, $utm_campaign, $utm_term, $utm_content, $referrer, $gclid, $fbclid]);
+ $stmt->execute([$webinar_id, $first_name, $last_name, $email, $company, $how_did_you_hear, $password_hash, $timezone]);
$webinar_date_obj = new DateTime($webinar['scheduled_at']);
$subject = "Confirmation: You're Registered for " . $webinar['title'];
@@ -71,9 +69,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
// --- PREPARE SUCCESS RESPONSE ---
$webinar_date = new DateTime($webinar['scheduled_at'], new DateTimeZone('UTC'));
- $start_time_utc = $webinar_date->format('Ymd H is Z');
+ $start_time_utc = $webinar_date->format('Ymd\THis\Z');
$webinar_date->add(new DateInterval('PT1H')); // Assume 1 hour duration
- $end_time_utc = $webinar_date->format('Ymd H is Z');
+ $end_time_utc = $webinar_date->format('Ymd\THis\Z');
$google_link = 'https://www.google.com/calendar/render?action=TEMPLATE&text=' . urlencode($webinar['title']) . '&dates=' . $start_time_utc . '/' . $end_time_utc . '&details=' . urlencode($webinar['description']) . '&ctz=UTC';
@@ -86,30 +84,33 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
]);
$outlook_link = 'data:text/calendar;charset=utf-8,' . rawurlencode($ics_content);
- $response = [
- 'success' => true,
- 'webinar_title' => $webinar['title'],
- 'google_link' => $google_link,
- 'outlook_link' => $outlook_link
- ];
+ $success_message = "
You’re in!
+
Thanks for registering for " . htmlspecialchars($webinar['title']) . ".
+
Check your email for your confirmation. You can now log in to see the details.
+
";
+
+ unset($_SESSION['form_data']); // Clear form data on success
}
} catch (Exception $e) {
error_log("Registration error: " . $e->getMessage());
- $response = ['success' => false, 'error' => 'An unexpected error occurred. Please try again.'];
+ $error_message = 'An unexpected error occurred. Please try again.';
}
}
- echo json_encode($response);
- exit;
-}
-
-// --- RENDER PAGE (Initial GET Request) ---
-$webinar_id = filter_input(INPUT_GET, 'webinar_id', FILTER_VALIDATE_INT) ?: 1;
-$webinar = get_webinar_details($webinar_id);
-
-if (!$webinar) {
- http_response_code(404);
- echo "Webinar not found.";
- exit;
+ if ($error_message) {
+ // Redirect back to the form with the error message
+ $_SESSION['error_message'] = $error_message;
+ header("Location: register.php?webinar_id = " . $webinar_id);
+ exit;
+ }
+} else {
+ // On GET request, check for session error messages
+ if (isset($_SESSION['error_message'])) {
+ $error_message = $_SESSION['error_message'];
+ unset($_SESSION['error_message']);
+ }
}
?>
@@ -119,8 +120,8 @@ if (!$webinar) {
Register for = htmlspecialchars($webinar['title']) ?>
-
= htmlspecialchars($webinar['title']) ?>
@@ -167,51 +163,54 @@ if (!$webinar) {
-
@@ -223,68 +222,6 @@ if (!$webinar) {
const localDate = new Date(webinarDateUTC + 'Z');
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' };
document.getElementById('local-date-time').textContent = localDate.toLocaleDateString(undefined, options);
-
- // --- TRACKING PARAMS ---
- const urlParams = new URLSearchParams(window.location.search);
- ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gclid', 'fbclid'].forEach(param => {
- if (urlParams.has(param)) {
- document.getElementById(param).value = urlParams.get(param);
- }
- });
- document.getElementById('referrer').value = document.referrer;
-
- // --- AJAX FORM SUBMISSION ---
- const form = document.getElementById('registration-form');
- const container = document.getElementById('registration-container');
- const errorContainer = document.getElementById('error-container');
-
- form.addEventListener('submit', function(event) {
- event.preventDefault();
-
- const submitButton = form.querySelector('.submit-btn');
- submitButton.disabled = true;
- submitButton.textContent = 'Processing...';
- errorContainer.innerHTML = '';
-
- const formData = new FormData(form);
-
- fetch(form.action, {
- method: 'POST',
- body: formData
- })
- .then(response => response.json())
- .then(data => {
- if (data.success) {
- container.innerHTML = `
-
-
You’re in!
-
Thanks for registering for ${escapeHTML(data.webinar_title)}.
-
Check your email for your confirmation. You can now log in to see the details.
-
-
- `;
- } else {
- errorContainer.innerHTML = `
${escapeHTML(data.error)}
`;
- submitButton.disabled = false;
- submitButton.textContent = 'Register Now';
- }
- })
- .catch(error => {
- console.error('Error:', error);
- errorContainer.innerHTML = '
A network error occurred. Please try again.
';
- submitButton.disabled = false;
- submitButton.textContent = 'Register Now';
- });
- });
-
- function escapeHTML(str) {
- var p = document.createElement("p");
- p.appendChild(document.createTextNode(str));
- return p.innerHTML;
- }