diff --git a/admin.php b/admin.php index 87d4fdc..dacd03f 100644 --- a/admin.php +++ b/admin.php @@ -20,8 +20,8 @@ require_once 'db/config.php'; $attendees = []; try { $pdo = db(); - // Updated to select first_name instead of name - $stmt = $pdo->query('SELECT a.id, w.title AS webinar_title, a.first_name, a.email, a.consented, a.created_at, a.timezone, a.utm_source, a.utm_medium, a.utm_campaign, a.referrer, a.gclid, a.fbclid FROM attendees a JOIN webinars w ON a.webinar_id = w.id ORDER BY a.created_at DESC'); + // Updated to select first_name and new fields + $stmt = $pdo->query('SELECT a.id, w.title AS webinar_title, a.first_name, a.last_name, a.email, a.company, a.how_did_you_hear, a.consented, a.created_at, a.timezone, a.utm_source, a.utm_medium, a.utm_campaign, a.referrer, a.gclid, a.fbclid FROM attendees a JOIN webinars w ON a.webinar_id = w.id ORDER BY a.created_at DESC'); $attendees = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (PDOException $e) { die("Could not connect to the database: " . $e->getMessage()); @@ -72,8 +72,11 @@ try { ID Webinar - Name + First Name + Last Name Email + Company + How did you hear? Consented Registered At Timezone @@ -88,7 +91,7 @@ try { - No attendees yet. + No attendees yet. @@ -96,7 +99,10 @@ try { + + + diff --git a/assets/pasted-20251017-094703-ce814c6a.png b/assets/pasted-20251017-094703-ce814c6a.png new file mode 100644 index 0000000..13efd36 Binary files /dev/null and b/assets/pasted-20251017-094703-ce814c6a.png differ diff --git a/register.php b/register.php index b133d4f..161a86f 100644 --- a/register.php +++ b/register.php @@ -10,9 +10,9 @@ $response = []; $webinar = null; if ($webinar_id) { try { - $stmt = db()->prepare("SELECT * FROM webinars WHERE id = ?"); - $stmt->execute([$webinar_id]); - $webinar = $stmt->fetch(); + // Fetch webinar details to create calendar links + $stmt = $pdo->query("SELECT title, description, starts_at, ends_at FROM webinars ORDER BY starts_at ASC LIMIT 1"); + $webinar = $stmt->fetch(PDO::FETCH_ASSOC); } catch (PDOException $e) { // Log error, but don't show to user } @@ -23,6 +23,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { header('Content-Type: application/json'); // --- DATA CAPTURE --- + $webinar_id = filter_input(INPUT_POST, 'webinar_id', FILTER_VALIDATE_INT); $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); @@ -82,7 +83,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $attendee_id = db()->lastInsertId(); // --- SEND CONFIRMATION EMAIL --- - $webinar_date = new DateTime($webinar['scheduled_at']); + $webinar_date = new DateTime($webinar['starts_at']); $subject = "Confirmation: You're Registered for " . $webinar['title']; $body_html = "

You're in!

" @@ -94,7 +95,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $response['success'] = true; $response['webinar_title'] = $webinar['title']; - $response['webinar_date_utc'] = $webinar['scheduled_at']; + $response['webinar_date_utc'] = $webinar['starts_at']; } catch (PDOException $e) { @@ -194,6 +195,7 @@ if (!$webinar) {

No spam. Unsubscribe anytime.

+ @@ -216,7 +218,7 @@ if (!$webinar) { const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; document.getElementById('timezone').value = timezone; - const webinarDateUTC = ''; + const webinarDateUTC = ''; const localDate = new Date(webinarDateUTC + 'Z'); // 'Z' for UTC const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' };