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(); session_start();
require_once 'db/config.php'; 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'])) { if (!isset($_SESSION['user_id'])) {
header('Location: login.php'); header('Location: login.php');
exit; 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; $attendee = null;
$webinar = null; $webinar = null;
$error = ''; $error = '';
$user_id = (int) $_SESSION['user_id'];
$user_id = $_SESSION['user_id'];
try { try {
// Fetch attendee details $stmt = db()->prepare('SELECT * FROM attendees WHERE id = ? AND deleted_at IS NULL');
$stmt = db()->prepare("SELECT * FROM attendees WHERE id = ?");
$stmt->execute([$user_id]); $stmt->execute([$user_id]);
$attendee = $stmt->fetch(); $attendee = $stmt->fetch(PDO::FETCH_ASSOC);
if ($attendee) { if ($attendee) {
// Fetch webinar details $stmt = db()->prepare('SELECT * FROM webinars WHERE id = ?');
$stmt = db()->prepare("SELECT * FROM webinars WHERE id = ?"); $stmt->execute([(int) $attendee['webinar_id']]);
$stmt->execute([$attendee['webinar_id']]); $webinar = $stmt->fetch(PDO::FETCH_ASSOC);
$webinar = $stmt->fetch();
} else { } else {
$error = 'Could not find your registration details.'; $error = 'Could not find your active registration details.';
} }
} catch (PDOException $e) { } 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> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <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> <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 { body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: #1a202c;
color: #e2e8f0;
margin: 0; margin: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh; 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 { .page {
max-width: 800px; min-height: 100vh;
padding: 2rem; display: flex;
align-items: center;
justify-content: center;
padding: 32px 20px;
} }
.dashboard-box { .card {
background-color: #2d3748; width: 100%;
border-radius: 0.5rem; max-width: 960px;
padding: 2rem; background: var(--surface);
border: 1px solid #4a5568; border: 1px solid var(--line);
border-radius: 28px;
box-shadow: var(--shadow);
backdrop-filter: blur(18px);
overflow: hidden;
} }
h1 { .shell {
font-size: 2rem; display: grid;
margin-bottom: 1rem; grid-template-columns: 1.15fr 0.85fr;
} }
.webinar-title { .main, .aside { padding: 40px; }
font-size: 1.5rem; .aside {
font-weight: bold; background: linear-gradient(180deg, rgba(11, 32, 131, 0.62), rgba(16, 41, 160, 0.82));
color: #f6e05e; border-left: 1px solid var(--line);
margin-bottom: 0.5rem;
} }
.webinar-date { .eyebrow {
font-size: 1.125rem; display: inline-flex;
margin-bottom: 1.5rem; 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 { h1, h2 { font-family: var(--font-display); margin: 0 0 14px; }
display: inline-block; h1 { font-size: clamp(2.1rem, 4vw, 3.2rem); line-height: 1.02; }
background-color: #f6e05e; h2 { font-size: 1.2rem; }
color: #1a202c; p { color: var(--text-soft); line-height: 1.65; }
padding: 0.75rem 1.5rem; .lead { font-size: 1.05rem; max-width: 44ch; }
border-radius: 0.375rem; .notice {
text-decoration: none; margin-top: 20px;
font-weight: bold; padding: 16px 18px;
font-size: 1.125rem; border-radius: 18px;
transition: background-color 0.2s; border: 1px solid rgba(255, 153, 169, 0.2);
} background: rgba(255, 153, 169, 0.12);
.join-button:hover {
background-color: #f6d32d;
}
.message {
padding: 1rem;
margin-bottom: 1rem;
border-radius: 0.25rem;
background-color: #c53030;
color: #fff; 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> </style>
</head> </head>
<body> <body>
<div class="container"> <main class="page">
<div class="dashboard-box"> <section class="card">
<h1>Your Dashboard</h1> <div class="shell">
<?php if ($error): ?> <div class="main">
<div class="message"><?= htmlspecialchars($error) ?></div> <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): ?> <?php elseif ($attendee && $webinar): ?>
<p>Hello, <strong><?= htmlspecialchars($attendee['first_name']) ?></strong>!</p> <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>
<p>You are registered for the following webinar:</p>
<div class="webinar-title"><?= htmlspecialchars($webinar['title']) ?></div> <div class="stats" aria-label="Registration details">
<div class="webinar-date"> <div class="stat">
<?php <div class="stat-label">Webinar</div>
$date = new DateTime($webinar['scheduled_at']); <div class="stat-value"><?php echo htmlspecialchars((string) ($webinar['title'] ?? 'Upcoming webinar')); ?></div>
echo $date->format('l, F j, Y \a\t g:i A T'); </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> </div>
<a href="join.php?id=<?= htmlspecialchars($attendee['id']) ?>" class="join-button">Join Webinar</a>
<?php else: ?> <?php else: ?>
<div class="message">Could not find your registration details.</div> <div class="notice">Could not find your registration details.</div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<footer style="margin-top: 2rem; font-size: 0.9rem; color: #a0aec0;"> <aside class="aside">
<a href="index.php" style="color: #a0aec0; text-decoration: none;"> Back to Home</a> <h2>What to expect</h2>
</footer> <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>
<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> </body>
</html> </html>

233
join.php
View File

@ -1,78 +1,233 @@
<?php <?php
session_start();
require_once 'db/config.php'; require_once 'db/config.php';
$attendee_id_encoded = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING); function resolve_attendee_id(): ?int {
if (!$attendee_id_encoded) { if (isset($_SESSION['user_id']) && is_numeric($_SESSION['user_id'])) {
http_response_code(400); return (int) $_SESSION['user_id'];
echo "Invalid link."; }
exit;
$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; $attendee = null;
$webinar = null; $webinar = null;
try { try {
$stmt = db()->prepare("SELECT * FROM attendees WHERE id = ?"); $stmt = db()->prepare('SELECT * FROM attendees WHERE id = ? AND deleted_at IS NULL');
$stmt->execute([$attendee_id]); $stmt->execute([$attendeeId]);
$attendee = $stmt->fetch(); $attendee = $stmt->fetch(PDO::FETCH_ASSOC);
if ($attendee) { if ($attendee) {
$stmt = db()->prepare("SELECT * FROM webinars WHERE id = ?"); $stmt = db()->prepare('SELECT * FROM webinars WHERE id = ?');
$stmt->execute([$attendee['webinar_id']]); $stmt->execute([(int) $attendee['webinar_id']]);
$webinar = $stmt->fetch(); $webinar = $stmt->fetch(PDO::FETCH_ASSOC);
} }
} catch (PDOException $e) { } catch (PDOException $e) {
// Log error error_log('Join page lookup failed: ' . $e->getMessage());
} }
if (!$attendee || !$webinar) { if (!$attendee || !$webinar) {
http_response_code(404); http_response_code(404);
echo "Registration not found."; echo 'Registration not found.';
exit; 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> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <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> <style>
body { :root {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; --bg-start: #071659;
background-color: #1a202c; --bg-end: #1029a0;
color: #e2e8f0; --surface: rgba(9, 24, 47, 0.84);
margin: 0; --surface-soft: rgba(221, 226, 253, 0.08);
display: flex; --line: rgba(221, 226, 253, 0.16);
justify-content: center; --text-main: #f3f9ff;
align-items: center; --text-soft: #dde2fd;
min-height: 100vh; --text-muted: #bbc8fb;
text-align: center; --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 { * { box-sizing: border-box; }
max-width: 800px; body {
padding: 2rem; 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 { h1 {
color: #f6e05e; font-family: var(--font-display);
font-size: 2.5rem; font-size: clamp(2.1rem, 4vw, 3rem);
margin: 16px 0 14px;
line-height: 1.02;
} }
p { p { color: var(--text-soft); line-height: 1.65; }
font-size: 1.25rem; .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> </style>
</head> </head>
<body> <body>
<div class="container"> <main class="card">
<h1>Welcome, <?= htmlspecialchars($attendee['name']) ?>!</h1> <span class="badge">Access confirmed</span>
<p>You are now joining the webinar: <strong><?= htmlspecialchars($webinar['title']) ?></strong></p> <h1>Welcome, <?php echo htmlspecialchars($participantName); ?>!</h1>
<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> <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>
<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> </body>
</html> </html>