-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_tickets.php
More file actions
153 lines (132 loc) · 4.98 KB
/
Copy pathview_tickets.php
File metadata and controls
153 lines (132 loc) · 4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
// Start the session
session_start();
// Check if the user is logged in as customer
if (!isset($_SESSION['username']) || $_SESSION['role'] !== 'customer') {
// If not logged in as customer, redirect to login page
header("Location: login.html");
exit();
}
// Ensure the user_id session variable is set
if (!isset($_SESSION['user_id'])) {
die("Error: User ID is not set.");
}
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "product_website";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Count the number of items in the cart
$cart_item_count = 0;
if (isset($_SESSION['cart'])) {
foreach ($_SESSION['cart'] as $quantity) {
$cart_item_count += $quantity;
}
}
// Fetch reservations for the logged-in customer
$customer_id = $_SESSION['user_id'];
$sql = "SELECT * FROM reservations WHERE customer_id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $customer_id);
$stmt->execute();
$result = $stmt->get_result();
$stmt->close();
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Reservations</title>
<link rel="stylesheet" href="style/floating_contact_button.css">
<link rel="stylesheet" href="style/reservation.css">
<link rel="stylesheet" href="style/footer.css">
<link rel="stylesheet" href="style/cart-btn.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link rel="stylesheet" href="style/h1.css">
<link rel="stylesheet" href="style/loader.css">
<script src="js/loader.js" defer></script>
<script src="js/audio.js" defer></script>
<script src="js/upbtn.js" defer></script>
</head>
<body>
<header>
<div class="header-container">
<a href="index.html" class="logo">
<img src="img/logo.png" alt="Zoo Parc Logo">
</a>
<div class="title-nav">
<h1>Zoo Parc
</h1>
<nav>
<ul>
<li><a href="member_dashboard.php" class="nav-btn">Home</a></li>
<li><a href="member_view_events.php" class="nav-btn">My Events</a></li>
<li><a href="view_events_member.php" class="nav-btn">Events</a></li>
<li><a href="contact_form.php" class="nav-btn">Information</a></li>
<li class="log-out"><a href="logout.php" class="nav-btn">Log Out</a></li>
</ul>
</nav>
</div>
</div>
</header>
<div id="loader">
<img src="images/logo.png" alt="The Gallery Café Logo">
<p>Loading, please wait...</p>
</div>
<main>
<div class="container">
<a href="create_reservation.php" class="cart-link">Add</a> <br>
</div>
<h2>My Reservations</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Number of Tickets</th>
<th>Ticket Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php if ($result->num_rows > 0) : ?>
<?php while ($row = $result->fetch_assoc()) : ?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['num_people']; ?></td>
<td><?php echo $row['parking_slot']; ?></td>
<td><?php echo $row['reservation_date']; ?></td>
<td><?php echo $row['status']; ?></td>
</tr>
<?php endwhile; ?>
<?php else : ?>
<tr>
<td colspan="5">No reservations found</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</section>
</main>
<footer>
<div class="footer-container">
<div class="social-icons">
<a href="https://facebook.com" target="_blank"><i class="fab fa-facebook-f"></i></a>
<a href="https://twitter.com" target="_blank"><i class="fab fa-twitter"></i></a>
<a href="https://instagram.com" target="_blank"><i class="fab fa-instagram"></i></a>
<a href="https://linkedin.com" target="_blank"><i class="fab fa-linkedin-in"></i></a>
</div>
<p>© 2024 The Gallery Café. All rights reserved.</p>
<p>123 Main Street, Colombo, Sri Lanka | Phone: +94 77 123 4567 | Email: info@gallerycafe.com</p>
</div>
</footer>
</body>
</html>