This commit is contained in:
Flatlogic Bot 2025-10-26 20:00:38 +00:00
parent 1b68b62fde
commit 84ff927075
2 changed files with 30 additions and 21 deletions

View File

@ -147,8 +147,8 @@
<img src="assets/pasted-20251017-115640-64b19aff.png" alt="AppWizzy Logo" style="height: 40px;">
</div>
<h1 class="webinar-title" style="line-height: 1.2;">Professional Vibe-Coding Webinar</h1>
<h2 class="webinar-subtitle">Building Scalable Apps with AppWizzy</h2>
<h1 class="webinar-title" style="line-height: 1.2;">Building Scalable Apps with AppWizzy</h1>
<h2 class="webinar-subtitle">Professional Vibe-Coding Webinar</h2>
<div class="webinar-time">WEDNESDAY, NOVEMBER 19 | 10AM EST | 7AM PST | 4PM CET</div>
<p class="webinar-description">The fastest way to go from an idea to a working app you own, running on your server, with your database, using real frameworks.</p>
<div class="speakers-section">

View File

@ -48,26 +48,35 @@ if (!$first_name || !$last_name || !$email) {
}
try {
// --- CHECK IF ALREADY REGISTERED ---
$stmt = db()->prepare("SELECT id FROM attendees WHERE webinar_id = ? AND email = ?");
// --- CHECK IF ALREADY REGISTERED OR SOFT-DELETED -- -
$stmt = db()->prepare("SELECT id, deleted_at FROM attendees WHERE webinar_id = ? AND email = ?");
$stmt->execute([$webinar_id, $email]);
if ($stmt->fetch()) {
echo json_encode(['success' => false, 'error' => 'You are already registered for this webinar.']);
exit;
}
$existing_user = $stmt->fetch(PDO::FETCH_ASSOC);
// --- REGISTER USER ---
// Generate a password hash from the email as we don't have a password field
$password_hash = password_hash($email . time(), PASSWORD_DEFAULT);
$sql = "INSERT INTO attendees (webinar_id, first_name, last_name, email, company, how_did_you_hear, password, timezone)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = db()->prepare($sql);
$stmt->execute([$webinar_id, $first_name, $last_name, $email, $company, $how_did_you_hear, $password_hash, $timezone]);
if ($existing_user) {
if ($existing_user['deleted_at'] !== null) {
// --- USER IS SOFT-DELETED, SO REACTIVATE AND UPDATE ---
$sql = "UPDATE attendees SET first_name = ?, last_name = ?, company = ?, how_did_you_hear = ?, timezone = ?, deleted_at = NULL, consented = 1 WHERE id = ?";
$stmt = db()->prepare($sql);
$stmt->execute([$first_name, $last_name, $company, $how_did_you_hear, $timezone, $existing_user['id']]);
} else {
// --- USER IS ACTIVE, SO REJECT ---
echo json_encode(['success' => false, 'error' => 'You are already registered for this webinar.']);
exit;
}
} else {
// --- REGISTER NEW USER ---
$password_hash = password_hash($email . time(), PASSWORD_DEFAULT);
$sql = "INSERT INTO attendees (webinar_id, first_name, last_name, email, company, how_did_you_hear, password, timezone)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = db()->prepare($sql);
$stmt->execute([$webinar_id, $first_name, $last_name, $email, $company, $how_did_you_hear, $password_hash, $timezone]);
}
// --- SEND CONFIRMATION EMAIL ---
$webinar_date_obj = new DateTime('2025-11-19 10:00:00', new DateTimeZone('America/New_York'));
$subject = "Confirmation: You're Registered for Professional Vibe-Coding Webinar";
$body_html = "<h1>You're in!</h1><p>Thanks for registering for our webinar: <strong>Professional Vibe-Coding Webinar</strong>.</p><p style='font-size: 0.8em;'><strong>Building Scalable Apps with AppWizzy</strong></p><p>It will take place on <strong>" . $webinar_date_obj->format('l, F j, Y \a\t g:i A T') . "</strong>.</p><p>You can now log in to your dashboard to see the details.</p>"
$subject = "Confirmation: You're Registered for Building Scalable Apps with AppWizzy";
$body_html = "<h1>You're in!</h1><p>Thanks for registering for our webinar: <strong>Building Scalable Apps with AppWizzy</strong>.</p><p style='font-size: 0.8em;'><strong>Professional Vibe-Coding Webinar</strong></p><p>It will take place on <strong>" . $webinar_date_obj->format('l, F j, Y \a\t g:i A T') . "</strong>.</p><p>You can now log in to your dashboard to see the details.</p>";
MailService::sendMail($email, $subject, $body_html);
// --- PREPARE SUCCESS RESPONSE ---
@ -77,15 +86,15 @@ try {
$webinar_date->add(new DateInterval('PT1H')); // Assume 1 hour duration
$end_time_utc = $webinar_date->format('Ymd\THis\Z');
$event_title = 'Professional Vibe-Coding Webinar at 4PM CET';
$event_description = 'Building Scalable Apps with AppWizzy\n\nJoin us for this webinar at 4PM CET | 10AM EST | 7AM PST. The fastest way to go from an idea to a working app you own, running on your server, with your database, using real frameworks.';
$event_title = 'Building Scalable Apps with AppWizzy at 4PM CET';
$event_description = 'Professional Vibe-Coding Webinar\n\nJoin us for this webinar at 4PM CET | 10AM EST | 7AM PST. The fastest way to go from an idea to a working app you own, running on your server, with your database, using real frameworks.';
$google_link = 'https://www.google.com/calendar/render?action=TEMPLATE&text=' . urlencode($event_title) . '&dates=' . $start_time_utc . '/' . $end_time_utc . '&details=' . urlencode($event_description) . '&location=' . urlencode('Online') . '&ctz=UTC';
$ics_content = implode("\r\n", [
'BEGIN:VCALENDAR',
'VERSION:2.0',
'PRODID:-//Flatlogic//Professional Vibe-Coding Webinar//EN',
'PRODID:-//Flatlogic//Building Scalable Apps with AppWizzy//EN',
'BEGIN:VEVENT',
'URL:' . 'http://' . $_SERVER['HTTP_HOST'],
'DTSTART:' . $start_time_utc,
@ -100,7 +109,7 @@ try {
echo json_encode([
'success' => true,
'webinar_title' => 'Professional Vibe-Coding Webinar<br><small><strong>Building Scalable Apps with AppWizzy</strong></small>',
'webinar_title' => 'Building Scalable Apps with AppWizzy<br><small><strong>Professional Vibe-Coding Webinar</strong></small>',
'google_link' => $google_link,
'outlook_link' => $outlook_link
]);