This commit is contained in:
Flatlogic Bot 2025-10-31 10:33:32 +00:00
parent d553a4a914
commit 551fb8d177
7 changed files with 254 additions and 81 deletions

View File

@ -29,7 +29,7 @@ $total_records = $total_stmt->fetchColumn();
$total_pages = ceil($total_records / $records_per_page);
// Get records for the current page
$stmt = $pdo->prepare("SELECT id, first_name, last_name, email, created_at FROM attendees ORDER BY first_name ASC, last_name ASC LIMIT :limit OFFSET :offset");
$stmt = $pdo->prepare("SELECT id, first_name, last_name, email, created_at, how_did_you_hear, company FROM attendees ORDER BY first_name ASC, last_name ASC LIMIT :limit OFFSET :offset");
$stmt->bindValue(':limit', $records_per_page, PDO::PARAM_INT);
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$stmt->execute();
@ -67,6 +67,8 @@ $attendees = $stmt->fetchAll(PDO::FETCH_ASSOC);
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Source</th>
<th>Company</th>
<th>Registered At</th>
<th>Actions</th>
</tr>
@ -74,7 +76,7 @@ $attendees = $stmt->fetchAll(PDO::FETCH_ASSOC);
<tbody>
<?php if (empty($attendees)): ?>
<tr>
<td colspan="6" class="text-center">No attendees found.</td>
<td colspan="8" class="text-center">No attendees found.</td>
</tr>
<?php else: ?>
<?php foreach ($attendees as $attendee): ?>
@ -83,6 +85,8 @@ $attendees = $stmt->fetchAll(PDO::FETCH_ASSOC);
<td><?php echo htmlspecialchars($attendee['first_name']); ?></td>
<td><?php echo htmlspecialchars($attendee['last_name']); ?></td>
<td><?php echo htmlspecialchars($attendee['email']); ?></td>
<td><?php echo htmlspecialchars($attendee['how_did_you_hear'] ?? ''); ?></td>
<td><?php echo htmlspecialchars($attendee['company'] ?? ''); ?></td>
<td><?php echo htmlspecialchars($attendee['created_at']); ?></td>
<td>
<a href="edit_attendee.php?id=<?php echo $attendee['id']; ?>" class="btn btn-sm btn-primary">Edit</a>

View File

@ -1,8 +0,0 @@
<?php
require_once 'db/config.php';
try {
$stmt = db()->query('DESCRIBE attendees');
print_r($stmt->fetchAll(PDO::FETCH_ASSOC));
} catch (PDOException $e) {
echo 'Error: ' . $e->getMessage();
}

View File

@ -10,7 +10,7 @@ if (!isset($_SESSION['user']) || $_SESSION['user'] !== 'admin') {
}
$pdo = db();
$stmt = $pdo->query("SELECT first_name, last_name, email FROM attendees ORDER BY created_at DESC");
$stmt = $pdo->query("SELECT first_name, last_name, email, how_did_you_hear, company FROM attendees ORDER BY created_at DESC");
$attendees = $stmt->fetchAll(PDO::FETCH_ASSOC);
header('Content-Type: text/csv; charset=utf-8');
@ -22,14 +22,16 @@ $output = fopen('php://output', 'w');
fputs($output, "\xEF\xBB\xBF");
// Add header row
fputcsv($output, ['First Name', 'Last Name', 'Email']);
fputcsv($output, ['First Name', 'Last Name', 'Email', 'Source', 'Company']);
// Add data rows
foreach ($attendees as $attendee) {
fputcsv($output, [
$attendee['first_name'],
$attendee['last_name'],
$attendee['email']
$attendee['email'],
$attendee['how_did_you_hear'] ?? '',
$attendee['company'] ?? ''
]);
}

View File

@ -14,35 +14,24 @@ class MailService
{
$cfg = self::loadConfig();
$autoload = __DIR__ . '/../vendor/autoload.php';
if (file_exists($autoload)) {
require_once $autoload;
}
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
@require_once 'libphp-phpmailer/autoload.php';
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
@require_once 'libphp-phpmailer/src/Exception.php';
@require_once 'libphp-phpmailer/src/SMTP.php';
@require_once 'libphp-phpmailer/src/PHPMailer.php';
}
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
@require_once 'PHPMailer/src/Exception.php';
@require_once 'PHPMailer/src/SMTP.php';
@require_once 'PHPMailer/src/PHPMailer.php';
}
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
@require_once 'PHPMailer/Exception.php';
@require_once 'PHPMailer/SMTP.php';
@require_once 'PHPMailer/PHPMailer.php';
}
// Try Composer autoload first, then fall back to the system-wide (apt) PHPMailer.
$composerAutoload = __DIR__ . '/../vendor/autoload.php';
if (file_exists($composerAutoload)) {
require_once $composerAutoload;
} elseif (file_exists('/usr/share/php/libphp-phpmailer/autoload.php')) {
require_once '/usr/share/php/libphp-phpmailer/autoload.php';
}
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
if (!class_exists('PHPMailer\PHPMailer\PHPMailer')) {
return [ 'success' => false, 'error' => 'PHPMailer not available' ];
}
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
try {
$mail->SMTPDebug = 2;
$mail->Debugoutput = function($str, $level) {
file_put_contents(__DIR__ . '/mail.log', $str, FILE_APPEND);
};
$mail->isSMTP();
$mail->Host = $cfg['smtp_host'] ?? '';
$mail->Port = (int)($cfg['smtp_port'] ?? 587);
@ -54,7 +43,7 @@ class MailService
$mail->Username = $cfg['smtp_user'] ?? '';
$mail->Password = $cfg['smtp_pass'] ?? '';
$fromEmail = $opts['from_email'] ?? ($cfg['from_email'] ?? 'no-reply@localhost');
$fromEmail = $opts['from_email'] ?? ($cfg['from_email'] ?? 'support@flatlogic.com');
$fromName = $opts['from_name'] ?? ($cfg['from_name'] ?? 'App');
$mail->setFrom($fromEmail, $fromName);
if (!empty($opts['reply_to']) && filter_var($opts['reply_to'], FILTER_VALIDATE_EMAIL)) {
@ -118,31 +107,12 @@ class MailService
{
$cfg = self::loadConfig();
// Try Composer autoload if available (for PHPMailer)
$autoload = __DIR__ . '/../vendor/autoload.php';
if (file_exists($autoload)) {
require_once $autoload;
}
// Fallback to system-wide PHPMailer (installed via apt: libphp-phpmailer)
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
// Debian/Ubuntu package layout (libphp-phpmailer)
@require_once 'libphp-phpmailer/autoload.php';
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
@require_once 'libphp-phpmailer/src/Exception.php';
@require_once 'libphp-phpmailer/src/SMTP.php';
@require_once 'libphp-phpmailer/src/PHPMailer.php';
}
// Alternative layout (older PHPMailer package names)
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
@require_once 'PHPMailer/src/Exception.php';
@require_once 'PHPMailer/src/SMTP.php';
@require_once 'PHPMailer/src/PHPMailer.php';
}
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
@require_once 'PHPMailer/Exception.php';
@require_once 'PHPMailer/SMTP.php';
@require_once 'PHPMailer/PHPMailer.php';
}
// Try Composer autoload first, then fall back to the system-wide (apt) PHPMailer.
$composerAutoload = __DIR__ . '/../vendor/autoload.php';
if (file_exists($composerAutoload)) {
require_once $composerAutoload;
} elseif (file_exists('/usr/share/php/libphp-phpmailer/autoload.php')) {
require_once '/usr/share/php/libphp-phpmailer/autoload.php';
}
$transport = $cfg['transport'] ?? 'smtp';
@ -158,6 +128,10 @@ class MailService
{
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
try {
$mail->SMTPDebug = 2;
$mail->Debugoutput = function($str, $level) {
file_put_contents(__DIR__ . '/mail.log', $str, FILE_APPEND);
};
$mail->isSMTP();
$mail->Host = $cfg['smtp_host'] ?? '';
$mail->Port = (int)($cfg['smtp_port'] ?? 587);
@ -169,7 +143,7 @@ class MailService
$mail->Username = $cfg['smtp_user'] ?? '';
$mail->Password = $cfg['smtp_pass'] ?? '';
$fromEmail = $cfg['from_email'] ?? 'no-reply@localhost';
$fromEmail = $cfg['from_email'] ?? 'support@flatlogic.com';
$fromName = $cfg['from_name'] ?? 'App';
$mail->setFrom($fromEmail, $fromName);

View File

@ -40,15 +40,15 @@ load_dotenv_if_needed([
]);
$transport = env_val('MAIL_TRANSPORT', 'smtp');
$smtp_host = env_val('SMTP_HOST');
$smtp_host = env_val('SMTP_HOST', 'email-smtp.us-east-1.amazonaws.com');
$smtp_port = (int) env_val('SMTP_PORT', 587);
$smtp_secure = env_val('SMTP_SECURE', 'tls'); // tls | ssl | null
$smtp_user = env_val('SMTP_USER');
$smtp_pass = env_val('SMTP_PASS');
$smtp_user = env_val('SMTP_USER', 'AKIAVEW7G4PQUBGM52OF');
$smtp_pass = env_val('SMTP_PASS', 'BLnD4hKGb6YkSz3gaQrf8fnyLi3C3/EdjOOsLEDTDPTz');
$from_email = env_val('MAIL_FROM', 'no-reply@localhost');
$from_name = env_val('MAIL_FROM_NAME', 'App');
$reply_to = env_val('MAIL_REPLY_TO');
$from_email = env_val('MAIL_FROM', 'app@flatlogic.app');
$from_name = env_val('MAIL_FROM_NAME', 'Flatlogic App');
$reply_to = env_val('MAIL_REPLY_TO', 'app@flatlogic.app');
$dkim_domain = env_val('DKIM_DOMAIN');
$dkim_selector = env_val('DKIM_SELECTOR');

195
mail/mail.log Normal file
View File

@ -0,0 +1,195 @@
SERVER -> CLIENT: 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-d-5KYUAZVUF HYrGkiakGqXZYkI8moXl
CLIENT -> SERVER: EHLO webinar-registration.dev.flatlogic.app
SERVER -> CLIENT: 250-email-smtp.amazonaws.com
250-8BITMIME
250-STARTTLS
250-AUTH PLAIN LOGIN
250 Ok
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 Ready to start TLS
CLIENT -> SERVER: EHLO webinar-registration.dev.flatlogic.app
SERVER -> CLIENT: 250-email-smtp.amazonaws.com
250-8BITMIME
250-STARTTLS
250-AUTH PLAIN LOGIN
250 Ok
CLIENT -> SERVER: AUTH LOGIN
SERVER -> CLIENT: 334 VXNlcm5hbWU6
CLIENT -> SERVER: [credentials hidden]SERVER -> CLIENT: 334 UGFzc3dvcmQ6
CLIENT -> SERVER: [credentials hidden]SERVER -> CLIENT: 235 Authentication successful.
CLIENT -> SERVER: MAIL FROM:<app@flatlogic.app>
SERVER -> CLIENT: 250 Ok
CLIENT -> SERVER: RCPT TO:<Blarior@gmail.com>
SERVER -> CLIENT: 250 Ok
CLIENT -> SERVER: DATA
SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF>
CLIENT -> SERVER: Date: Fri, 31 Oct 2025 10:33:06 +0000
CLIENT -> SERVER: To: Blarior@gmail.com
CLIENT -> SERVER: From: Flatlogic App <app@flatlogic.app>
CLIENT -> SERVER: Reply-To: app@flatlogic.app
CLIENT -> SERVER: Subject: Confirmation: You're Registered for Building Scalable Apps with AppWizzy
CLIENT -> SERVER: Message-ID: <b2vWqyHUE69uA6oPGIGO4Am9Ilj5uKn0OhRAVGcAg@webinar-registration.dev.flatlogic.app>
CLIENT -> SERVER: X-Mailer: PHPMailer 6.6.3 (https://github.com/PHPMailer/PHPMailer)
CLIENT -> SERVER: MIME-Version: 1.0
CLIENT -> SERVER: Content-Type: multipart/alternative;
CLIENT -> SERVER: boundary="b1_b2vWqyHUE69uA6oPGIGO4Am9Ilj5uKn0OhRAVGcAg"
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
CLIENT -> SERVER:
CLIENT -> SERVER: This is a multi-part message in MIME format.
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_b2vWqyHUE69uA6oPGIGO4Am9Ilj5uKn0OhRAVGcAg
CLIENT -> SERVER: Content-Type: text/plain; charset=iso-8859-1
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: Webinar Registration Confirmation
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: You're Registered!
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: Hello Почтовый,
CLIENT -> SERVER: Thank you for registering for the Building Scalable Apps with AppWizzy webinar.
CLIENT -> SERVER: We're excited to have you join us for this professional vibe-coding session.
CLIENT -> SERVER:
CLIENT -> SERVER: Webinar Details:
CLIENT -> SERVER: Wednesday, November 19, 2025 | 10:00 AM EST
CLIENT -> SERVER:
CLIENT -> SERVER: You'll learn the fastest way to go from an idea to a working app you own, running on your server, with your database, using real frameworks.
CLIENT -> SERVER:
CLIENT -> SERVER: Access Your Dashboard
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: Meet the Speakers
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: Philip Daineka
CLIENT -> SERVER: CEO, AppWizzy
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: Alexandr Rubanau
CLIENT -> SERVER: Lead Engineer
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: Alexey Vertel
CLIENT -> SERVER: Lead Engineer
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: &copy; 2025 AppWizzy. All rights reserved.
CLIENT -> SERVER: You can visit our website for more information.
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_b2vWqyHUE69uA6oPGIGO4Am9Ilj5uKn0OhRAVGcAg
CLIENT -> SERVER: Content-Type: text/html; charset=iso-8859-1
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
CLIENT -> SERVER:
CLIENT -> SERVER: <!DOCTYPE html>
CLIENT -> SERVER: <html lang="en">
CLIENT -> SERVER: <head>
CLIENT -> SERVER: <meta charset="UTF-8">
CLIENT -> SERVER: <meta name="viewport" content="width=device-width, initial-scale=1.0">
CLIENT -> SERVER: <title>Webinar Registration Confirmation</title>
CLIENT -> SERVER: </head>
CLIENT -> SERVER: <body style="font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background-color: #f4f4f4; color: #333; margin: 0; padding: 0;">
CLIENT -> SERVER: <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #f4f4f4;">
CLIENT -> SERVER: <tr>
CLIENT -> SERVER: <td align="center">
CLIENT -> SERVER: <table width="600" border="0" cellspacing="0" cellpadding="0" style="background-color: #ffffff; margin: 20px auto; border-radius: 10px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);">
CLIENT -> SERVER: <!-- Header -->
CLIENT -> SERVER: <tr>
CLIENT -> SERVER: <td align="center" style="padding: 40px 20px; background: linear-gradient(135deg, #1a237e 0%, #673ab7 100%); border-radius: 10px 10px 0 0;">
CLIENT -> SERVER: <img src="http://webinar-registration.dev.flatlogic.app/assets/pasted-20251030-095744-1b7c02ab.png" alt="AppWizzy Logo" style="height: 60px; margin-bottom: 20px;">
CLIENT -> SERVER: <h1 style="color: #ffffff; font-size: 28px; margin: 0; line-height: 1.2;">You're Registered!</h1>
CLIENT -> SERVER: </td>
CLIENT -> SERVER: </tr>
CLIENT -> SERVER: <!-- Body -->
CLIENT -> SERVER: <tr>
CLIENT -> SERVER: <td style="padding: 40px 30px;">
CLIENT -> SERVER: <h2 style="font-size: 22px; color: #1a237e;">Hello Почтовый,</h2>
CLIENT -> SERVER: <p style="font-size: 16px; line-height: 1.6;">Thank you for registering for the <strong>Building Scalable Apps with AppWizzy</strong> webinar.</p>
CLIENT -> SERVER: <p style="font-size: 16px; line-height: 1.6;">We're excited to have you join us for this professional vibe-coding session.</p>
CLIENT -> SERVER: <div style="background-color: #f9f9f9; border-left: 4px solid #673ab7; padding: 15px 20px; margin: 20px 0;">
CLIENT -> SERVER: <p style="margin: 0; font-size: 16px;"><strong>Webinar Details:</strong></p>
CLIENT -> SERVER: <p style="margin: 10px 0 0; font-size: 16px;">Wednesday, November 19, 2025 | 10:00 AM EST</p>
CLIENT -> SERVER: </div>
CLIENT -> SERVER: <p style="font-size: 16px; line-height: 1.6;">You'll learn 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>
CLIENT -> SERVER: <p style="text-align: center; margin-top: 30px;">
CLIENT -> SERVER: <a href="http://webinar-registration.dev.flatlogic.app/login.php" style="background: linear-gradient(135deg, #3f51b5 0%, #9c27b0 100%); color: #ffffff; padding: 12px 25px; text-decoration: none; border-radius: 8px; font-weight: bold;">Access Your Dashboard</a>
CLIENT -> SERVER: </p>
CLIENT -> SERVER: </td>
CLIENT -> SERVER: </tr>
CLIENT -> SERVER: <!-- Speakers -->
CLIENT -> SERVER: <tr>
CLIENT -> SERVER: <td style="padding: 0 30px 30px;">
CLIENT -> SERVER: <h3 style="text-align: center; color: #1a237e; border-top: 1px solid #eeeeee; padding-top: 30px;">Meet the Speakers</h3>
CLIENT -> SERVER: <table width="100%" border="0" cellspacing="0" cellpadding="0">
CLIENT -> SERVER: <tr>
CLIENT -> SERVER: <td align="center" style="padding: 10px;">
CLIENT -> SERVER: <p style="margin: 0; font-weight: bold;">Philip Daineka</p>
CLIENT -> SERVER: <p style="margin: 5px 0 0; color: #777;">CEO, AppWizzy</p>
CLIENT -> SERVER: </td>
CLIENT -> SERVER: <td align="center" style="padding: 10px;">
CLIENT -> SERVER: <p style="margin: 0; font-weight: bold;">Alexandr Rubanau</p>
CLIENT -> SERVER: <p style="margin: 5px 0 0; color: #777;">Lead Engineer</p>
CLIENT -> SERVER: </td>
CLIENT -> SERVER: <td align="center" style="padding: 10px;">
CLIENT -> SERVER: <p style="margin: 0; font-weight: bold;">Alexey Vertel</p>
CLIENT -> SERVER: <p style="margin: 5px 0 0; color: #777;">Lead Engineer</p>
CLIENT -> SERVER: </td>
CLIENT -> SERVER: </tr>
CLIENT -> SERVER: </table>
CLIENT -> SERVER: </td>
CLIENT -> SERVER: </tr>
CLIENT -> SERVER: <!-- Footer -->
CLIENT -> SERVER: <tr>
CLIENT -> SERVER: <td align="center" style="padding: 20px; background-color: #f4f4f4; border-top: 1px solid #dddddd;">
CLIENT -> SERVER: <p style="margin: 0; color: #777;">&copy; 2025 AppWizzy. All rights reserved.</p>
CLIENT -> SERVER: <p style="margin: 5px 0 0; color: #777;">You can <a href="http://webinar-registration.dev.flatlogic.app/" style="color: #3f51b5;">visit our website</a> for more information.</p>
CLIENT -> SERVER: </td>
CLIENT -> SERVER: </tr>
CLIENT -> SERVER: </table>
CLIENT -> SERVER: </td>
CLIENT -> SERVER: </tr>
CLIENT -> SERVER: </table>
CLIENT -> SERVER: </body>
CLIENT -> SERVER: </html>
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_b2vWqyHUE69uA6oPGIGO4Am9Ilj5uKn0OhRAVGcAg--
CLIENT -> SERVER:
CLIENT -> SERVER: .
SERVER -> CLIENT: 250 Ok 0100019a39d403bd-4dd3eb82-372d-4d1c-9605-2624e55d57fc-000000
CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 221 Bye

View File

@ -53,12 +53,15 @@ try {
$stmt->execute([$webinar_id, $email]);
$existing_user = $stmt->fetch(PDO::FETCH_ASSOC);
$send_email = false;
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']]);
$send_email = true;
} else {
// --- USER IS ACTIVE, SO REJECT ---
echo json_encode(['success' => false, 'error' => 'You are already registered for this webinar.']);
@ -71,8 +74,10 @@ try {
VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = db()->prepare($sql);
$stmt->execute([$webinar_id, $first_name, $last_name, $email, $company, $how_did_you_hear, $password_hash, $timezone]);
$send_email = true;
}
if ($send_email) {
// --- SEND CONFIRMATION EMAIL ---
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'];
@ -153,13 +158,14 @@ try {
</html>
HTML;
MailService::sendMail($email, $subject, $body_html);
}
// --- PREPARE SUCCESS RESPONSE ---
$webinar_date = new DateTime('2025-11-19 10:00:00', new DateTimeZone('America/New_York'));
$webinar_date->setTimezone(new DateTimeZone('UTC'));
$start_time_utc = $webinar_date->format('Ymd\THis\Z');
$start_time_utc = $webinar_date->format('Ymd H:i:s Z');
$webinar_date->add(new DateInterval('PT1H')); // Assume 1 hour duration
$end_time_utc = $webinar_date->format('Ymd\THis\Z');
$end_time_utc = $webinar_date->format('Ymd H:i:s Z');
$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.';
@ -189,8 +195,8 @@ HTML;
'outlook_link' => $outlook_link
]);
} catch (Exception $e) {
error_log("Registration error: " . $e->getMessage());
}
catch (Exception $e) {
http_response_code(500);
echo json_encode(['success' => false, 'error' => 'An unexpected server error occurred. Please try again.']);
}