From 01edc11ccd14a982b0c747abdbb6e4c5086decd0 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Tue, 10 Mar 2026 06:38:59 +0000 Subject: [PATCH] 333 --- dashboard.php | 328 ++++++++++++++++++++++++++++++++++++++------------ join.php | 235 ++++++++++++++++++++++++++++++------ 2 files changed, 443 insertions(+), 120 deletions(-) diff --git a/dashboard.php b/dashboard.php index 9e87d2e..768478b 100644 --- a/dashboard.php +++ b/dashboard.php @@ -2,125 +2,293 @@ session_start(); require_once 'db/config.php'; +if (isset($_GET['logout']) && $_GET['logout'] === '1') { + unset($_SESSION['user_id']); + session_regenerate_id(true); + header('Location: login.php'); + exit; +} + if (!isset($_SESSION['user_id'])) { header('Location: login.php'); exit; } +function format_dashboard_datetime(?string $scheduledAt, ?string $timezone): string { + if (!$scheduledAt) { + return 'Schedule to be announced'; + } + + try { + $date = new DateTime($scheduledAt, new DateTimeZone('UTC')); + if (!empty($timezone) && in_array($timezone, timezone_identifiers_list(), true)) { + $date->setTimezone(new DateTimeZone($timezone)); + return $date->format('l, F j, Y \a\t g:i A T'); + } + + return $date->format('l, F j, Y \a\t g:i A T'); + } catch (Throwable $e) { + return $scheduledAt; + } +} + $attendee = null; $webinar = null; $error = ''; - -$user_id = $_SESSION['user_id']; +$user_id = (int) $_SESSION['user_id']; try { - // Fetch attendee details - $stmt = db()->prepare("SELECT * FROM attendees WHERE id = ?"); + $stmt = db()->prepare('SELECT * FROM attendees WHERE id = ? AND deleted_at IS NULL'); $stmt->execute([$user_id]); - $attendee = $stmt->fetch(); + $attendee = $stmt->fetch(PDO::FETCH_ASSOC); if ($attendee) { - // Fetch webinar details - $stmt = db()->prepare("SELECT * FROM webinars WHERE id = ?"); - $stmt->execute([$attendee['webinar_id']]); - $webinar = $stmt->fetch(); + $stmt = db()->prepare('SELECT * FROM webinars WHERE id = ?'); + $stmt->execute([(int) $attendee['webinar_id']]); + $webinar = $stmt->fetch(PDO::FETCH_ASSOC); } else { - $error = 'Could not find your registration details.'; + $error = 'Could not find your active registration details.'; } } catch (PDOException $e) { - $error = 'Database error. Please try again later.'; + error_log('Dashboard load failed: ' . $e->getMessage()); + $error = 'Dashboard is temporarily unavailable. Please try again later.'; } +$participantName = trim((string) (($attendee['first_name'] ?? '') . ' ' . ($attendee['last_name'] ?? ''))); +$participantName = $participantName !== '' ? $participantName : ((string) ($attendee['email'] ?? 'Guest')); +$joinLink = $attendee ? 'join.php?id=' . rawurlencode(base64_encode((string) $attendee['id'])) : 'login.php'; +$webinarDate = $webinar ? format_dashboard_datetime($webinar['scheduled_at'] ?? null, $attendee['timezone'] ?? null) : 'Schedule to be announced'; ?> - Your Webinar Dashboard + Your Webinar Dashboard | AppWizzy + + + + + -
-
-

Your Dashboard

- -
- -

Hello, !

-

You are registered for the following webinar:

-
-
- format('l, F j, Y \a\t g:i A T'); - ?> +
+
+
+
+ Registered attendee +

Your webinar dashboard

+ +
+ +

Hi — your seat is confirmed. Use the join button below when it is time to enter the webinar room.

+ +
+
+
Webinar
+
+
+
+
Scheduled time
+
+
+
+
Email
+
+
+
+
Timezone
+
+
+
+ + + +
Could not find your registration details.
+
- Join Webinar - -
Could not find your registration details.
- -
- -
+ +
+ + diff --git a/join.php b/join.php index b69a694..027f204 100644 --- a/join.php +++ b/join.php @@ -1,78 +1,233 @@ setTimezone(new DateTimeZone($timezone)); + } + return $date->format('l, F j, Y \a\t g:i A T'); + } catch (Throwable $e) { + return $scheduledAt; + } +} + +$attendeeId = resolve_attendee_id(); +if ($attendeeId === null) { + http_response_code(400); + echo 'Invalid webinar access link.'; + exit; +} $attendee = null; $webinar = null; try { - $stmt = db()->prepare("SELECT * FROM attendees WHERE id = ?"); - $stmt->execute([$attendee_id]); - $attendee = $stmt->fetch(); + $stmt = db()->prepare('SELECT * FROM attendees WHERE id = ? AND deleted_at IS NULL'); + $stmt->execute([$attendeeId]); + $attendee = $stmt->fetch(PDO::FETCH_ASSOC); if ($attendee) { - $stmt = db()->prepare("SELECT * FROM webinars WHERE id = ?"); - $stmt->execute([$attendee['webinar_id']]); - $webinar = $stmt->fetch(); + $stmt = db()->prepare('SELECT * FROM webinars WHERE id = ?'); + $stmt->execute([(int) $attendee['webinar_id']]); + $webinar = $stmt->fetch(PDO::FETCH_ASSOC); } - } catch (PDOException $e) { - // Log error + error_log('Join page lookup failed: ' . $e->getMessage()); } if (!$attendee || !$webinar) { http_response_code(404); - echo "Registration not found."; + echo 'Registration not found.'; exit; } -// For now, just a welcome message. In a real scenario, this would redirect to the webinar platform. - +$participantName = trim((string) (($attendee['first_name'] ?? '') . ' ' . ($attendee['last_name'] ?? ''))); +$participantName = $participantName !== '' ? $participantName : ((string) ($attendee['email'] ?? 'Guest')); +$scheduledLabel = format_join_datetime($webinar['scheduled_at'] ?? null, $attendee['timezone'] ?? null); ?> - Welcome to the Webinar + Join Webinar | AppWizzy + + + + + -
-

Welcome, !

-

You are now joining the webinar:

-

The webinar is scheduled for: format('l, F j, Y \a\t g:i A T') ?>

-
+
+ Access confirmed +

Welcome, !

+

Your registration is active. When the live room is available, this page is where you can connect attendees to the webinar experience.

+ +
+
+
Webinar
+
+
+
+
Scheduled time
+
+
+
+
Registered email
+
+
+
+
Timezone
+
+
+
+ + +