This commit is contained in:
Flatlogic Bot 2026-03-10 06:38:59 +00:00
parent 281e356fda
commit 01edc11ccd
2 changed files with 443 additions and 120 deletions

View File

@ -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';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Webinar Dashboard</title>
<title>Your Webinar Dashboard | AppWizzy</title>
<meta name="description" content="Access your webinar registration details and join link for the AppWizzy event.">
<meta name="robots" content="noindex, nofollow">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-start: #071659;
--bg-end: #1029a0;
--surface: rgba(9, 24, 47, 0.82);
--surface-soft: rgba(221, 226, 253, 0.08);
--line: rgba(221, 226, 253, 0.16);
--text-main: #f3f9ff;
--text-soft: #dde2fd;
--text-muted: #bbc8fb;
--accent: #6ed4ff;
--accent-strong: #2c4bd1;
--success: #18d1b3;
--danger: #ff99a9;
--shadow: 0 30px 80px rgba(2, 10, 24, 0.48);
--font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
--font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: #1a202c;
color: #e2e8f0;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
font-family: var(--font-body);
color: var(--text-main);
background:
radial-gradient(circle at top left, rgba(110, 212, 255, 0.18), transparent 28%),
radial-gradient(circle at bottom right, rgba(44, 75, 209, 0.20), transparent 32%),
linear-gradient(145deg, var(--bg-start) 0%, var(--bg-end) 100%);
}
.container {
max-width: 800px;
padding: 2rem;
.page {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 32px 20px;
}
.dashboard-box {
background-color: #2d3748;
border-radius: 0.5rem;
padding: 2rem;
border: 1px solid #4a5568;
.card {
width: 100%;
max-width: 960px;
background: var(--surface);
border: 1px solid var(--line);
border-radius: 28px;
box-shadow: var(--shadow);
backdrop-filter: blur(18px);
overflow: hidden;
}
h1 {
font-size: 2rem;
margin-bottom: 1rem;
.shell {
display: grid;
grid-template-columns: 1.15fr 0.85fr;
}
.webinar-title {
font-size: 1.5rem;
font-weight: bold;
color: #f6e05e;
margin-bottom: 0.5rem;
.main, .aside { padding: 40px; }
.aside {
background: linear-gradient(180deg, rgba(11, 32, 131, 0.62), rgba(16, 41, 160, 0.82));
border-left: 1px solid var(--line);
}
.webinar-date {
font-size: 1.125rem;
margin-bottom: 1.5rem;
.eyebrow {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 8px 14px;
border-radius: 999px;
background: rgba(110, 212, 255, 0.12);
color: var(--accent);
font-size: 0.88rem;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.join-button {
display: inline-block;
background-color: #f6e05e;
color: #1a202c;
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
text-decoration: none;
font-weight: bold;
font-size: 1.125rem;
transition: background-color 0.2s;
}
.join-button:hover {
background-color: #f6d32d;
}
.message {
padding: 1rem;
margin-bottom: 1rem;
border-radius: 0.25rem;
background-color: #c53030;
h1, h2 { font-family: var(--font-display); margin: 0 0 14px; }
h1 { font-size: clamp(2.1rem, 4vw, 3.2rem); line-height: 1.02; }
h2 { font-size: 1.2rem; }
p { color: var(--text-soft); line-height: 1.65; }
.lead { font-size: 1.05rem; max-width: 44ch; }
.notice {
margin-top: 20px;
padding: 16px 18px;
border-radius: 18px;
border: 1px solid rgba(255, 153, 169, 0.2);
background: rgba(255, 153, 169, 0.12);
color: #fff;
}
.stats {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
margin-top: 28px;
}
.stat {
padding: 18px;
border-radius: 20px;
background: var(--surface-soft);
border: 1px solid rgba(221, 226, 253, 0.12);
}
.stat-label {
color: var(--text-muted);
font-size: 0.82rem;
text-transform: uppercase;
letter-spacing: 0.06em;
margin-bottom: 8px;
}
.stat-value {
font-size: 1.05rem;
font-weight: 700;
color: var(--text-main);
}
.actions {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-top: 28px;
}
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 14px 20px;
border-radius: 16px;
text-decoration: none;
font-weight: 700;
transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
background: linear-gradient(135deg, #6ed4ff 0%, #2c4bd1 100%);
color: #071659;
box-shadow: 0 18px 36px rgba(44, 75, 209, 0.28);
}
.btn-secondary {
background: rgba(221, 226, 253, 0.10);
border: 1px solid rgba(221, 226, 253, 0.18);
color: var(--text-main);
}
.aside-card {
padding: 20px;
border-radius: 20px;
background: rgba(221, 226, 253, 0.08);
border: 1px solid rgba(221, 226, 253, 0.12);
margin-bottom: 16px;
}
.aside-card strong {
display: block;
margin-bottom: 8px;
font-size: 1rem;
}
.aside small {
color: var(--text-muted);
}
.footer-link {
margin-top: 18px;
display: inline-block;
color: var(--text-soft);
text-decoration: none;
}
@media (max-width: 860px) {
.shell { grid-template-columns: 1fr; }
.aside { border-left: 0; border-top: 1px solid var(--line); }
.main, .aside { padding: 28px; }
.stats { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="container">
<div class="dashboard-box">
<h1>Your Dashboard</h1>
<?php if ($error): ?>
<div class="message"><?= htmlspecialchars($error) ?></div>
<?php elseif ($attendee && $webinar): ?>
<p>Hello, <strong><?= htmlspecialchars($attendee['first_name']) ?></strong>!</p>
<p>You are registered for the following webinar:</p>
<div class="webinar-title"><?= htmlspecialchars($webinar['title']) ?></div>
<div class="webinar-date">
<?php
$date = new DateTime($webinar['scheduled_at']);
echo $date->format('l, F j, Y \a\t g:i A T');
?>
<main class="page">
<section class="card">
<div class="shell">
<div class="main">
<span class="eyebrow">Registered attendee</span>
<h1>Your webinar dashboard</h1>
<?php if ($error !== ''): ?>
<div class="notice"><?php echo htmlspecialchars($error); ?></div>
<?php elseif ($attendee && $webinar): ?>
<p class="lead">Hi <strong><?php echo htmlspecialchars($participantName); ?></strong> — your seat is confirmed. Use the join button below when it is time to enter the webinar room.</p>
<div class="stats" aria-label="Registration details">
<div class="stat">
<div class="stat-label">Webinar</div>
<div class="stat-value"><?php echo htmlspecialchars((string) ($webinar['title'] ?? 'Upcoming webinar')); ?></div>
</div>
<div class="stat">
<div class="stat-label">Scheduled time</div>
<div class="stat-value"><?php echo htmlspecialchars($webinarDate); ?></div>
</div>
<div class="stat">
<div class="stat-label">Email</div>
<div class="stat-value"><?php echo htmlspecialchars((string) ($attendee['email'] ?? '—')); ?></div>
</div>
<div class="stat">
<div class="stat-label">Timezone</div>
<div class="stat-value"><?php echo htmlspecialchars((string) (($attendee['timezone'] ?? '') !== '' ? $attendee['timezone'] : 'UTC')); ?></div>
</div>
</div>
<div class="actions">
<a href="<?php echo htmlspecialchars($joinLink); ?>" class="btn btn-primary">Join webinar</a>
<a href="index.php" class="btn btn-secondary">Back to site</a>
<a href="dashboard.php?logout=1" class="btn btn-secondary">Log out</a>
</div>
<?php else: ?>
<div class="notice">Could not find your registration details.</div>
<?php endif; ?>
</div>
<a href="join.php?id=<?= htmlspecialchars($attendee['id']) ?>" class="join-button">Join Webinar</a>
<?php else: ?>
<div class="message">Could not find your registration details.</div>
<?php endif; ?>
</div>
<footer style="margin-top: 2rem; font-size: 0.9rem; color: #a0aec0;">
<a href="index.php" style="color: #a0aec0; text-decoration: none;"> Back to Home</a>
</footer>
</div>
<aside class="aside">
<h2>What to expect</h2>
<div class="aside-card">
<strong>Live product session</strong>
<small>See how AppWizzy goes from idea to a working app with a real database and a real deployment flow.</small>
</div>
<div class="aside-card">
<strong>Practical takeaways</strong>
<small>Architecture, ownership, scaling, and why generated apps should stay editable.</small>
</div>
<div class="aside-card">
<strong>Need help?</strong>
<small>If your details look wrong, return to the main page and submit the form again, or contact the organizer.</small>
</div>
<a class="footer-link" href="login.php"> Back to login</a>
</aside>
</div>
</section>
</main>
</body>
</html>

235
join.php
View File

@ -1,78 +1,233 @@
<?php
session_start();
require_once 'db/config.php';
$attendee_id_encoded = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING);
if (!$attendee_id_encoded) {
http_response_code(400);
echo "Invalid link.";
exit;
function resolve_attendee_id(): ?int {
if (isset($_SESSION['user_id']) && is_numeric($_SESSION['user_id'])) {
return (int) $_SESSION['user_id'];
}
$raw = isset($_GET['id']) ? trim((string) $_GET['id']) : '';
if ($raw === '') {
return null;
}
if (ctype_digit($raw)) {
return (int) $raw;
}
$decoded = base64_decode(strtr($raw, ' ', '+'), true);
if ($decoded !== false && ctype_digit($decoded)) {
return (int) $decoded;
}
return null;
}
$attendee_id = base64_decode($attendee_id_encoded);
function format_join_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');
} 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);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to the Webinar</title>
<title>Join Webinar | AppWizzy</title>
<meta name="description" content="Join the AppWizzy webinar room and review your registration details.">
<meta name="robots" content="noindex, nofollow">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap" rel="stylesheet">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: #1a202c;
color: #e2e8f0;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
:root {
--bg-start: #071659;
--bg-end: #1029a0;
--surface: rgba(9, 24, 47, 0.84);
--surface-soft: rgba(221, 226, 253, 0.08);
--line: rgba(221, 226, 253, 0.16);
--text-main: #f3f9ff;
--text-soft: #dde2fd;
--text-muted: #bbc8fb;
--accent: #6ed4ff;
--accent-strong: #2c4bd1;
--success: #18d1b3;
--font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
--font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
}
.container {
max-width: 800px;
padding: 2rem;
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
padding: 24px;
font-family: var(--font-body);
color: var(--text-main);
background:
radial-gradient(circle at top left, rgba(110, 212, 255, 0.18), transparent 28%),
radial-gradient(circle at bottom right, rgba(44, 75, 209, 0.20), transparent 32%),
linear-gradient(145deg, var(--bg-start) 0%, var(--bg-end) 100%);
}
.card {
width: 100%;
max-width: 840px;
padding: 36px;
background: var(--surface);
border: 1px solid var(--line);
border-radius: 28px;
box-shadow: 0 30px 80px rgba(2, 10, 24, 0.48);
backdrop-filter: blur(18px);
}
.badge {
display: inline-flex;
padding: 8px 14px;
border-radius: 999px;
background: rgba(24, 209, 179, 0.14);
color: var(--success);
font-size: 0.88rem;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
}
h1 {
color: #f6e05e;
font-size: 2.5rem;
font-family: var(--font-display);
font-size: clamp(2.1rem, 4vw, 3rem);
margin: 16px 0 14px;
line-height: 1.02;
}
p {
font-size: 1.25rem;
p { color: var(--text-soft); line-height: 1.65; }
.grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
margin: 28px 0;
}
.item {
padding: 18px;
border-radius: 20px;
background: var(--surface-soft);
border: 1px solid rgba(221, 226, 253, 0.12);
}
.item-label {
color: var(--text-muted);
font-size: 0.82rem;
text-transform: uppercase;
letter-spacing: 0.06em;
margin-bottom: 8px;
}
.item-value {
font-weight: 700;
font-size: 1.02rem;
}
.actions {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-top: 24px;
}
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 14px 20px;
border-radius: 16px;
text-decoration: none;
font-weight: 700;
transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
background: linear-gradient(135deg, #6ed4ff 0%, #2c4bd1 100%);
color: #071659;
box-shadow: 0 18px 36px rgba(44, 75, 209, 0.28);
}
.btn-secondary {
background: rgba(221, 226, 253, 0.10);
border: 1px solid rgba(221, 226, 253, 0.18);
color: var(--text-main);
}
@media (max-width: 720px) {
.card { padding: 28px; }
.grid { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="container">
<h1>Welcome, <?= htmlspecialchars($attendee['name']) ?>!</h1>
<p>You are now joining the webinar: <strong><?= htmlspecialchars($webinar['title']) ?></strong></p>
<p>The webinar is scheduled for: <strong><?= (new DateTime($webinar['scheduled_at']))->format('l, F j, Y \a\t g:i A T') ?></strong></p>
</div>
<main class="card">
<span class="badge">Access confirmed</span>
<h1>Welcome, <?php echo htmlspecialchars($participantName); ?>!</h1>
<p>Your registration is active. When the live room is available, this page is where you can connect attendees to the webinar experience.</p>
<section class="grid" aria-label="Registration summary">
<div class="item">
<div class="item-label">Webinar</div>
<div class="item-value"><?php echo htmlspecialchars((string) ($webinar['title'] ?? 'Upcoming webinar')); ?></div>
</div>
<div class="item">
<div class="item-label">Scheduled time</div>
<div class="item-value"><?php echo htmlspecialchars($scheduledLabel); ?></div>
</div>
<div class="item">
<div class="item-label">Registered email</div>
<div class="item-value"><?php echo htmlspecialchars((string) ($attendee['email'] ?? '—')); ?></div>
</div>
<div class="item">
<div class="item-label">Timezone</div>
<div class="item-value"><?php echo htmlspecialchars((string) (($attendee['timezone'] ?? '') !== '' ? $attendee['timezone'] : 'UTC')); ?></div>
</div>
</section>
<div class="actions">
<a href="dashboard.php" class="btn btn-primary">Back to dashboard</a>
<a href="index.php" class="btn btn-secondary">Open main site</a>
</div>
</main>
</body>
</html>