diff --git a/register.php b/register.php index 161a86f..8c304d8 100644 --- a/register.php +++ b/register.php @@ -10,8 +10,8 @@ $response = []; $webinar = null; if ($webinar_id) { try { - // 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"); + $stmt = $pdo->prepare("SELECT title, description, starts_at, ends_at FROM webinars WHERE id = ?"); + $stmt->execute([$webinar_id]); $webinar = $stmt->fetch(PDO::FETCH_ASSOC); } catch (PDOException $e) { // Log error, but don't show to user @@ -21,9 +21,22 @@ if ($webinar_id) { // --- FORM SUBMISSION (POST REQUEST) --- if ($_SERVER["REQUEST_METHOD"] == "POST") { header('Content-Type: application/json'); - + // --- DATA CAPTURE --- $webinar_id = filter_input(INPUT_POST, 'webinar_id', FILTER_VALIDATE_INT); + + // --- WEBINAR DETAILS --- + $webinar = null; + if ($webinar_id) { + try { + // Fetch webinar details to create calendar links + $stmt = $pdo->prepare("SELECT title, description, starts_at, ends_at FROM webinars WHERE id = ?"); + $stmt->execute([$webinar_id]); + $webinar = $stmt->fetch(PDO::FETCH_ASSOC); + } catch (PDOException $e) { + // Log error, but don't show to user + } + } $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); @@ -178,8 +191,20 @@ if (!$webinar) {
We’ll send the join link & calendar invite.