67 lines
2.0 KiB
PHP
67 lines
2.0 KiB
PHP
<?php
|
|
session_start();
|
|
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header('Location: login.php');
|
|
exit();
|
|
}
|
|
|
|
require_once 'db/config.php';
|
|
$conn = db();
|
|
|
|
$user_id = $_SESSION['user_id'];
|
|
|
|
// Fetch tickets for the user
|
|
$stmt = $conn->prepare("SELECT events.name, events.date, events.location FROM tickets JOIN events ON tickets.event_id = events.id WHERE tickets.user_id = :user_id ORDER BY events.date ASC");
|
|
$stmt->bindParam(':user_id', $user_id, PDO::PARAM_INT);
|
|
$stmt->execute();
|
|
$tickets = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>My Tickets - EventPlatform</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
|
|
<?php require_once './includes/header.php'; ?>
|
|
|
|
<div class="container mt-5">
|
|
<h1 class="mb-4">My Tickets</h1>
|
|
|
|
<div class="card">
|
|
<div class="card-header">
|
|
Your Purchased Tickets
|
|
</div>
|
|
<div class="card-body">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Event Name</th>
|
|
<th>Date</th>
|
|
<th>Location</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($tickets as $ticket): ?>
|
|
<tr>
|
|
<td><?php echo htmlspecialchars($ticket['name']); ?></td>
|
|
<td><?php echo htmlspecialchars($ticket['date']); ?></td>
|
|
<td><?php echo htmlspecialchars($ticket['location']); ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|