1234567
This commit is contained in:
parent
f400adcf7c
commit
ac0f115fb6
@ -86,12 +86,13 @@ try {
|
||||
<th>Referrer</th>
|
||||
<th>GCLID</th>
|
||||
<th>FBCLID</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($attendees)): ?>
|
||||
<tr>
|
||||
<td colspan="16" class="text-center">No attendees yet.</td>
|
||||
<td colspan="17" class="text-center">No attendees yet.</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($attendees as $attendee): ?>
|
||||
@ -112,6 +113,12 @@ try {
|
||||
<td><?= htmlspecialchars($attendee['referrer']) ?></td>
|
||||
<td><?= htmlspecialchars($attendee['gclid']) ?></td>
|
||||
<td><?= htmlspecialchars($attendee['fbclid']) ?></td>
|
||||
<td>
|
||||
<form action="delete_attendee.php" method="POST" onsubmit="return confirm('Are you sure you want to delete this attendee?');">
|
||||
<input type="hidden" name="id" value="<?= $attendee['id'] ?>">
|
||||
<button type="submit" class="btn btn-danger btn-sm">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
26
delete_attendee.php
Normal file
26
delete_attendee.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
// If the user is not logged in as admin, do nothing.
|
||||
if (!isset($_SESSION['user']) || $_SESSION['user'] !== 'admin') {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['id'])) {
|
||||
require_once 'db/config.php';
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare('DELETE FROM attendees WHERE id = :id');
|
||||
$stmt->bindParam(':id', $_POST['id'], PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
} catch (PDOException $e) {
|
||||
// In a real app, you'd log this error.
|
||||
// For this example, we'll just stop execution.
|
||||
die("Database error: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect back to the admin page
|
||||
header('Location: admin.php');
|
||||
exit;
|
||||
10
register.php
10
register.php
@ -171,6 +171,16 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
<a href="index.php" style="color: #f6e05e; text-decoration: underline;">Back to Home</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php elseif ($error_message && strpos($error_message, 'You are already registered') !== false): ?>
|
||||
<div class="success-message">
|
||||
<h1>Already Registered</h1>
|
||||
<p><?= htmlspecialchars($error_message) ?></p>
|
||||
<p>You can view webinar details on your dashboard.</p>
|
||||
<div style="margin-top: 2rem;">
|
||||
<a href="dashboard.php" style="color: #f6e05e; text-decoration: underline;">Go to Dashboard</a>
|
||||
<a href="index.php" style="color: #f6e05e; text-decoration: underline; margin-left: 1rem;">Back to Home</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php if ($error_message): ?>
|
||||
<div class="error-message"><?= htmlspecialchars($error_message) ?></div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user