-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtickets.php
More file actions
374 lines (317 loc) · 12.8 KB
/
tickets.php
File metadata and controls
374 lines (317 loc) · 12.8 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<?php
session_start();
// Check if the user is logged in as a member
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
// Database connection
$servername = "localhost";
$username = "root";
$password = ""; // Update this if your root user has a password
$dbname = "zoo_website";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $_POST['name'];
$email = $_POST['email'];
$ticket_type = $_POST['ticket_type'];
$quantity = $_POST['quantity'];
$card_number = $_POST['card_number'];
$expiry_date = $_POST['expiry_date'];
$cvv = $_POST['cvv'];
// Calculate the total amount based on ticket type and quantity
$amount = 0;
if ($ticket_type == 'general') {
$amount = 50 * $quantity;
} elseif ($ticket_type == 'vip') {
$amount = 100 * $quantity;
} elseif ($ticket_type == 'student') {
$amount = 30 * $quantity;
}
// Simulate payment processing (replace with real payment gateway logic)
$payment_successful = true; // Assume payment is successful for this example
if ($payment_successful) {
$payment_status = 'paid';
$payment_date = date('Y-m-d H:i:s');
$user_id = $_SESSION['user_id']; // Get the logged-in user's ID from the session
// Generate a new ticket_id manually, based on the last inserted one
$result = $conn->query("SELECT MAX(ticket_id) AS max_ticket_id FROM member_ticket_payments");
$row = $result->fetch_assoc();
$ticket_id = $row['max_ticket_id'] + 1; // Increment by 1
// Insert payment record with manually managed ticket_id
$stmt = $conn->prepare("INSERT INTO member_ticket_payments (user_id, ticket_id, amount, payment_status, payment_date) VALUES (?, ?, ?, ?, ?)");
$stmt->bind_param('iisss', $user_id, $ticket_id, $amount, $payment_status, $payment_date);
if ($stmt->execute()) {
// Redirect to the same page with a success parameter
header("Location: tickets.php?success=1");
exit();
} else {
echo "There was an error processing your payment. Please try again.";
}
$stmt->close();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Member Ticket Purchase</title>
<!-- Font Awesome for Icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400..700&family=Sevillana&display=swap" rel="stylesheet"><link rel="stylesheet" href="style/index.css">
<link rel="stylesheet" href="style/index.css">
<link rel="stylesheet" href="style/ticket_members.css">
<link rel="stylesheet" href="style/scroll up music.css">
<link rel="stylesheet" href="style/ticket-btn.css">
<link rel="stylesheet" href="style/map-btn.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>
<script type="text/javascript">
function showSuccessMessage() {
var urlParams = new URLSearchParams(window.location.search);
if (urlParams.has('success') && urlParams.get('success') == '1') {
alert("Thank you! Your payment was successful, and your ticket has been purchased.");
window.location.href = 'tickets.php'; // Redirect back to the same page
}
}
window.onload = showSuccessMessage;
</script>
<style>
/* Import desired fonts from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Pacifico&family=Bree+Serif&family=Lobster&display=swap');
@keyframes blink {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
h1 {
font-size: 70px !important; /* Force the font size to apply */
color: #ffcc00;
text-align: center;
font-family: 'Pacifico', 'Lobster', 'Bree Serif', 'Arial', sans-serif; /* Multiple fonts for fallback */
margin-top: 1px;
padding: 1px;
border-radius: 1px;
display: inline-block;
text-shadow:
0 0 1px #000000,
0 0 10px #fffef9,
0 0 20px #ECDFCC,
0 0 30px #ffffff,
0 0 40px #ECDFCC,
0 0 50px #ffffff;
animation: blink 0.09s infinite; /* Adjusted animation for a smoother effect */
}
h3{
color:rgb(234, 57, 13);
}
.t-btn{
background-color: rgb(234, 57, 13);
color: white;
padding: 10px 20px;
border: none;
cursor: pointer;
transition: background-color 0.3s ease;
}
.t-btn :hover{
background-color: #333;
transform: scale(1.05);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.home-item-t {
position: fixed; /* To position the animals relative to the button */
}
.home-item-t {
position: relative; /* To position the animals relative to the button */
}
.animal-animation-t {
position: absolute;
top: -100px; /* Adjust to position the animation above the button */
left: 75px;
transform: translateX(-50%);
display: flex;
gap: 10px; /* Adjust space between animals */
}
.animal-t {
width: 60px; /* Adjust size as needed */
animation: play 5s infinite; /* Example animation */
}
.t-btn {
width: 100%;
padding: 7px 10px;
border-radius: 5px;
margin-left: 1px;
background-color: white;
color: rgb(234, 57, 13);
text-decoration: none;
margin: 5px;
cursor: pointer;
border: 2px solid rgb(234, 57, 13);
}
.t-btn:hover{
background-color: rgb(234, 57, 13);
border: 2px solid rgb(234, 57, 13);
color: white;
transform: scale(1.1);
}
.btn-sub {
background-color: #d23939;
color: white;
border: 2px solid #d23939;
padding: 10px 20px;
border: none;
cursor: pointer;
width: 100%;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
.btn-sub:hover{
background-color: white;
color: #d23939;
border: 2px solid #d23939;
width: 100%;
}
</style>
</head>
<?php
// Get the current page name
$current_page = basename($_SERVER['PHP_SELF']);
?>
<body>
<header>
<div class="header-container">
<a href="member_dashboard.php" 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="img/logo.png" alt="Zoo Parc Logo">
<p>Loading, please wait...</p>
</div>
<main>
<!-- Ticket Payment Form Section -->
<div class="ticket-form-container">
<a href="view_my_tickets.php" class="t-btn">My Ticket</a>
<h2>Purchase Your Ticket</h2>
<form action="tickets.php" method="POST"> <!-- Make sure this action points to the current file -->
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="ticket_type">Ticket Type:</label>
<select id="ticket_type" name="ticket_type" required>
<option value="general">General Admission - $50</option>
<option value="vip">VIP Admission - $100</option>
<option value="student">Student Admission - $30</option>
</select>
<label for="quantity">Quantity:</label>
<input type="number" id="quantity" name="quantity" min="1" max="10" required>
<h3>Payment Information</h3>
<label for="card_number">Card Number:</label>
<input type="number" id="card_number" name="card_number" min="1" maxlength="9999999999999999" max="9999999999999999" required>
<label for="expiry_date">Expiry Date:</label>
<input type="month" id="expiry_date" name="expiry_date" required>
<label for="cvv">CVV:</label>
<input type="number" id="cvv" name="cvv" min="101" minlength="101" max="999" maxlength="999" required>
<button type="submit" class="btn-sub">Submit Payment</button>
</form>
</div>
</main>
</body>
<!-- Enhanced Footer -->
<footer
class="footer">
<div class="footer-content">
</div>
<div class="footer-section links">
</div>
</div>
<br>
<div class="footer-bottom">
<div class="footer-section about">
<div class="social-icons">
<p class="footer-head"><i class="fas fa-leaf icon"></i>
Zoo Parc - The Zoological Park
<i class="fas fa-paw icon"></i> <br></p>
<p>Together, we CAN make a difference! If you'd like to help our wildlife charity,
there are lots of ways you can do so... THANK YOU for your ongoing SUPPORT.</p>
<p>Zoo Parc is home to over 31,000 animals across 128 acres of lush gardens.
Come explore and learn about wildlife and conservation efforts.</p> <br>
<a href="#"><i class="fab fa-facebook"></i></a>
<a href="#"><i class="fab fa-instagram"></i></a>
<a href="#"><i class="fab fa-twitter"></i></a>
<a href="#"><i class="fab fa-google-plus"></i></a>
<a href="#"><i class="fab fa-youtube"></i></a>
<p> © 2024 Zoo Parc - The Zoological Park |
Designed by<a href="https://www.instagram.com/luna.layl_/" class="btn-su"
target="_blank" >Sumalka Kodithuwakku<i class="fab fa-pagelines icon-lv" id="icon-lv"></i></a></p>
</div>
</div>
</div>
<div class="quick-links">
<p> Quick - Links
<a href="member_dashboard.php" class="quick-link-btn">Home</a>|
<a href="tickets.php" class="quick-link-btn">Buy Tickets</a>|
<a href="registration.php" class="quick-link-btn">Register</a>|
<a href="forgot_password.php" class="quick-link-btn">Reset-Password</a> </p>
</div>
</footer>
<!-- Scroll to Top Button -->
<div class="scroll-to-top" id="scrollToTop">
<a href="#top" class="scroll-btn">
<i class="fas fa-chevron-up"></i>
</a>
</div>
<!-- Floating Audio Control -->
<div id="audio-control">
<button id="musicPlaying">▶</button> <!-- Play Icon -->
<audio id="background-music" loop>
<source src="images/mp3.mp3" type="audio/mpeg">
browser not support the audio
</audio>
</div>
<!-- Floating ticket Button -->
<div class="floating-cart">
<a href="view_my_tickets.php" class="cart-btn">
<img src="img/ticket-icon.png" alt="Buy Ticket">
</a>
<!-- Floating Map Button -->
<div class="floating-map">
<a href="ZooMapmem.html" class="map-btn">
<img src="img/map.gif" alt="Zoo Map">
</a>
</html>