322
This commit is contained in:
parent
4ba12356e0
commit
d762bc8263
14
admin.php
14
admin.php
@ -20,8 +20,8 @@ require_once 'db/config.php';
|
|||||||
$attendees = [];
|
$attendees = [];
|
||||||
try {
|
try {
|
||||||
$pdo = db();
|
$pdo = db();
|
||||||
// Updated to select first_name instead of name
|
// Updated to select first_name and new fields
|
||||||
$stmt = $pdo->query('SELECT a.id, w.title AS webinar_title, a.first_name, a.email, a.consented, a.created_at, a.timezone, a.utm_source, a.utm_medium, a.utm_campaign, a.referrer, a.gclid, a.fbclid FROM attendees a JOIN webinars w ON a.webinar_id = w.id ORDER BY a.created_at DESC');
|
$stmt = $pdo->query('SELECT a.id, w.title AS webinar_title, a.first_name, a.last_name, a.email, a.company, a.how_did_you_hear, a.consented, a.created_at, a.timezone, a.utm_source, a.utm_medium, a.utm_campaign, a.referrer, a.gclid, a.fbclid FROM attendees a JOIN webinars w ON a.webinar_id = w.id ORDER BY a.created_at DESC');
|
||||||
$attendees = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$attendees = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
die("Could not connect to the database: " . $e->getMessage());
|
die("Could not connect to the database: " . $e->getMessage());
|
||||||
@ -72,8 +72,11 @@ try {
|
|||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>Webinar</th>
|
<th>Webinar</th>
|
||||||
<th>Name</th>
|
<th>First Name</th>
|
||||||
|
<th>Last Name</th>
|
||||||
<th>Email</th>
|
<th>Email</th>
|
||||||
|
<th>Company</th>
|
||||||
|
<th>How did you hear?</th>
|
||||||
<th>Consented</th>
|
<th>Consented</th>
|
||||||
<th>Registered At</th>
|
<th>Registered At</th>
|
||||||
<th>Timezone</th>
|
<th>Timezone</th>
|
||||||
@ -88,7 +91,7 @@ try {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php if (empty($attendees)): ?>
|
<?php if (empty($attendees)): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="13" class="text-center">No attendees yet.</td>
|
<td colspan="16" class="text-center">No attendees yet.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php foreach ($attendees as $attendee): ?>
|
<?php foreach ($attendees as $attendee): ?>
|
||||||
@ -96,7 +99,10 @@ try {
|
|||||||
<td><?= htmlspecialchars($attendee['id']) ?></td>
|
<td><?= htmlspecialchars($attendee['id']) ?></td>
|
||||||
<td><?= htmlspecialchars($attendee['webinar_title']) ?></td>
|
<td><?= htmlspecialchars($attendee['webinar_title']) ?></td>
|
||||||
<td><?= htmlspecialchars($attendee['first_name']) ?></td>
|
<td><?= htmlspecialchars($attendee['first_name']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($attendee['last_name']) ?></td>
|
||||||
<td><?= htmlspecialchars($attendee['email']) ?></td>
|
<td><?= htmlspecialchars($attendee['email']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($attendee['company']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($attendee['how_did_you_hear']) ?></td>
|
||||||
<td><?= $attendee['consented'] ? 'Yes' : 'No' ?></td>
|
<td><?= $attendee['consented'] ? 'Yes' : 'No' ?></td>
|
||||||
<td><?= htmlspecialchars($attendee['created_at']) ?></td>
|
<td><?= htmlspecialchars($attendee['created_at']) ?></td>
|
||||||
<td><?= htmlspecialchars($attendee['timezone']) ?></td>
|
<td><?= htmlspecialchars($attendee['timezone']) ?></td>
|
||||||
|
|||||||
BIN
assets/pasted-20251017-094703-ce814c6a.png
Normal file
BIN
assets/pasted-20251017-094703-ce814c6a.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
14
register.php
14
register.php
@ -10,9 +10,9 @@ $response = [];
|
|||||||
$webinar = null;
|
$webinar = null;
|
||||||
if ($webinar_id) {
|
if ($webinar_id) {
|
||||||
try {
|
try {
|
||||||
$stmt = db()->prepare("SELECT * FROM webinars WHERE id = ?");
|
// Fetch webinar details to create calendar links
|
||||||
$stmt->execute([$webinar_id]);
|
$stmt = $pdo->query("SELECT title, description, starts_at, ends_at FROM webinars ORDER BY starts_at ASC LIMIT 1");
|
||||||
$webinar = $stmt->fetch();
|
$webinar = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
// Log error, but don't show to user
|
// Log error, but don't show to user
|
||||||
}
|
}
|
||||||
@ -23,6 +23,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
// --- DATA CAPTURE ---
|
// --- DATA CAPTURE ---
|
||||||
|
$webinar_id = filter_input(INPUT_POST, 'webinar_id', FILTER_VALIDATE_INT);
|
||||||
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
|
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
|
||||||
$first_name = filter_input(INPUT_POST, 'first_name', FILTER_SANITIZE_STRING);
|
$first_name = filter_input(INPUT_POST, 'first_name', FILTER_SANITIZE_STRING);
|
||||||
$last_name = filter_input(INPUT_POST, 'last_name', FILTER_SANITIZE_STRING);
|
$last_name = filter_input(INPUT_POST, 'last_name', FILTER_SANITIZE_STRING);
|
||||||
@ -82,7 +83,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
$attendee_id = db()->lastInsertId();
|
$attendee_id = db()->lastInsertId();
|
||||||
|
|
||||||
// --- SEND CONFIRMATION EMAIL ---
|
// --- SEND CONFIRMATION EMAIL ---
|
||||||
$webinar_date = new DateTime($webinar['scheduled_at']);
|
$webinar_date = new DateTime($webinar['starts_at']);
|
||||||
$subject = "Confirmation: You're Registered for " . $webinar['title'];
|
$subject = "Confirmation: You're Registered for " . $webinar['title'];
|
||||||
|
|
||||||
$body_html = "<h1>You're in!</h1>"
|
$body_html = "<h1>You're in!</h1>"
|
||||||
@ -94,7 +95,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
|
|
||||||
$response['success'] = true;
|
$response['success'] = true;
|
||||||
$response['webinar_title'] = $webinar['title'];
|
$response['webinar_title'] = $webinar['title'];
|
||||||
$response['webinar_date_utc'] = $webinar['scheduled_at'];
|
$response['webinar_date_utc'] = $webinar['starts_at'];
|
||||||
|
|
||||||
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
@ -194,6 +195,7 @@ if (!$webinar) {
|
|||||||
</div>
|
</div>
|
||||||
<p class="microcopy" style="margin-top:-1rem; margin-bottom: 1.5rem;">No spam. Unsubscribe anytime.</p>
|
<p class="microcopy" style="margin-top:-1rem; margin-bottom: 1.5rem;">No spam. Unsubscribe anytime.</p>
|
||||||
|
|
||||||
|
<input type="hidden" name="webinar_id" value="<?= $webinar_id ?>">
|
||||||
<input type="hidden" name="timezone" id="timezone">
|
<input type="hidden" name="timezone" id="timezone">
|
||||||
<input type="hidden" name="utm_source" id="utm_source">
|
<input type="hidden" name="utm_source" id="utm_source">
|
||||||
<input type="hidden" name="utm_medium" id="utm_medium">
|
<input type="hidden" name="utm_medium" id="utm_medium">
|
||||||
@ -216,7 +218,7 @@ if (!$webinar) {
|
|||||||
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
document.getElementById('timezone').value = timezone;
|
document.getElementById('timezone').value = timezone;
|
||||||
|
|
||||||
const webinarDateUTC = '<?= $webinar["scheduled_at"] ?>';
|
const webinarDateUTC = '<?= $webinar["starts_at"] ?>';
|
||||||
const localDate = new Date(webinarDateUTC + 'Z'); // 'Z' for UTC
|
const localDate = new Date(webinarDateUTC + 'Z'); // 'Z' for UTC
|
||||||
|
|
||||||
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' };
|
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user