-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserPayment.php
More file actions
382 lines (347 loc) · 14.6 KB
/
UserPayment.php
File metadata and controls
382 lines (347 loc) · 14.6 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
372
373
374
375
376
377
378
379
380
381
382
<?php
require_once "controllers/AdminUsersProfileController.php";
require_once "controllers/UserPaymentController.php";
$AdminUserProfileController = new AdminUsersProfileController();
$UserPaymentController = new UserPaymentController();
if (session_status() !== PHP_SESSION_ACTIVE)
{
session_start();
// Check if the user is logged in
if (isset($_SESSION['email']))
{
$userEmail = $_SESSION['email'];
$specificUsers = $AdminUserProfileController->getSpecificUsers($userEmail);
$user = $specificUsers[0];
if (isset($_POST['membership_id']))
{
$membership_id = $_POST['membership_id'];
$resultmembership = $UserPaymentController->getSpecificMemberships($membership_id);
$membership = $resultmembership[0];
if (isset($_POST["updateMembership"]))
{
$membership_id = isset($_POST["membership_id"]) ? $_POST["membership_id"] : "";
$resultmembership = $UserPaymentController->getSpecificMemberships($membership_id);
$membership = $resultmembership[0];
$membershipName = $membership["membership_name"];
try
{
$success = $UserPaymentController->updateMembership($membershipName, $userEmail);
if ($success)
{
$message = true;
header('Location: UserProfile.php');
exit;
}
else
{
$message = false;
}
}
catch (Exception $e)
{
echo "An error occurred: " . $e->getMessage();
}
}
}
}
else
{
// Redirect to login if not logged in
header('Location: controllers/LogoutController.php');
exit;
}
}
else
{
// Redirect to login if not logged in
header('Location: controllers/LogoutController.php');
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>SteamGaming</title>
<meta content="" name="description">
<meta content="" name="keywords">
<!-- Page Mini Icon -->
<link href="assets/favicon.png" rel="icon">
<link href="assets/logo.png" rel="apple-touch-icon">
<!-- Import Fonts -->
<link href="https://fonts.googleapis.com" rel="preconnect">
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap" rel="stylesheet">
<!-- Import CSS Files -->
<link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
<link href="assets/vendor/glightbox/css/glightbox.min.css" rel="stylesheet">
<link href="assets/vendor/swiper/swiper-bundle.min.css" rel="stylesheet">
<link href="assets/vendor/aos/aos.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.2/dist/sweetalert2.min.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.2/dist/sweetalert2.all.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.js"></script>
<!-- Import Main CSS Files -->
<link href="views/userpayment/user_profile.css" rel="stylesheet">
</head>
<body class="membership-page" data-bs-spy="scroll" data-bs-target="#navmenu">
<!-- Navigation Bar -->
<header id="header" class="header fixed-top d-flex align-items-center">
<div class="container-fluid d-flex align-items-center justify-content-between">
<a href="index.php" class="logo d-flex align-items-center me-auto me-xl-0"><img src="assets/steamgaming.png" alt=""></a>
<nav id="navmenu" class="navmenu">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="Store.php">Store</a></li>
<li class="dropdown has-dropdown"><a href="Membership.php"><span>Membership</span> <i class="bi bi-chevron-down"></i></a>
<ul class="dd-box-shadow">
<li><a href="Membership.php#features">Features</a></li>
<li><a href="Membership.php#glimpse">Glimpse</a></li>
<li><a href="Membership.php#pricing">Pricing</a></li>
<li><a href="Membership.php#faq">FAQ</a></li>
</ul>
</li>
<li class="dropdown has-dropdown"><a href="About.php"><span>About</span> <i class="bi bi-chevron-down"></i></a>
<ul class="dd-box-shadow">
<li><a href="About.php#team">Team Members</a></li>
<li><a href="About.php#contact">Contact</a></li>
</ul>
</li>
<?php
if (isset($_SESSION['email']))
{
echo '<li><a href="UserProfile.php">My Profile</a></li>';
echo '<li><a href="UserOrder.php">My Order</a></li>';
}
?>
</ul>
<i class="mobile-nav-toggle d-xl-none bi bi-list"></i>
</nav>
<?php
if (isset($_SESSION['email']))
{
echo '<a class="btn-getstarted" href="controllers/LogoutController.php" onclick="return confirm(\'Are you sure you want to logout?\')">Logout</a>';
}
else
{
echo '<a class="btn-getstarted" href="LoginSignup.php">Login</a>';
}
?>
</div>
</header>
<!-- Payment -->
<section style="background-color: #212529;">
<div class="container py-5">
<div class="card">
<div class="card-body">
<div class="row d-flex justify-content-center">
<div class="col-md-8 col-xl-6 mb-4 mb-md-0">
<!-- <div class="py-1 d-flex flex-row"> -->
<!-- Back Button -->
<!-- <h4><a href="#!"><i class="bi bi-arrow-bar-left"></i>Back</a></h4> -->
<!-- </div> -->
<div class="row py-5">
<!-- Product Picture -->
<div id="paypic" class="col-md-7" style="height: auto;">
<img src="data:image/jpeg;base64,<?= base64_encode($membership["membership_image"]) ?>" alt="No Image" class="img-fluid" style="width: 100%; height: auto; object-fit: contain; object-position: center;">
</div>
<!-- Product Info -->
<div id="payinfo" class="col-md-5" style="height: auto;">
<!-- Product Price -->
<h4 class="text-success py-4">RM <?php echo $membership["membership_price"]; ?>.00</h4>
<!-- Product Name -->
<h4><?php echo $membership["membership_name"]; ?></h4>
<!-- Product Description -->
<div class="rounded py-3 d-flex" style="background-color: #f8f9fa; height: 70%; width: 100%;">
<div class="p-2"><?php echo $membership["membership_description"]; ?></div>
</div>
</div>
</div>
</div>
<div class="col-md-4 col-xl-4 offset-xl-1 py-5">
<!-- Order Recap -->
<div class="rounded d-flex flex-column p-2" style="background-color: #f8f9fa;">
<div class="p-2 me-3">
<h4>Order Recap</h4>
</div>
<!-- Item Price Recap -->
<div class="p-2 d-flex">
<div class="col-8">Item Price</div>
<div class="ms-auto">RM <?php echo $membership["membership_price"]; ?>.00</div>
</div>
<!-- Discount Recap -->
<div class="border-top px-2 mx-2"></div>
<div class="p-2 d-flex pt-3">
<div class="col-8">Discount Applied</div>
<div class="ms-auto">0 %</div>
</div>
<div class="p-2 d-flex">
<div class="col-8">Price Cut</div>
<div class="ms-auto">RM 0.00</div>
</div>
<!-- Total Price Recap -->
<div class="border-top px-2 mx-2"></div>
<div class="p-2 d-flex pt-3">
<div class="col-8"><b>Total</b></div>
<div class="ms-auto"><b class="text-success">RM <?php echo $membership["membership_price"]; ?>.00</b></div>
</div>
</div>
<!-- Payment Method -->
<div class="pt-2">
<div class="d-flex pb-2 py-3">
<div>
<p><b>Payment Method</b></p>
</div>
</div>
<!-- Payment Method Radio -->
<div class="pb-3">
<!-- Payment Method 1 -->
<div class="d-flex flex-row pb-3">
<div class="d-flex align-items-center pe-2">
<input class="form-check-input" type="radio" name="radioNoLabel" id="radioNoLabel1" value="" aria-label="..." checked />
</div>
<div class="rounded border d-flex w-100 p-3 align-items-center">
<p class="mb-0"><i class="fab fa-cc-visa fa-lg text-primary pe-2"></i>Touch 'n Go</p>
</div>
</div>
<!-- Payment Method 2 -->
<div class="d-flex flex-row pb-3">
<div class="d-flex align-items-center pe-2">
<input class="form-check-input" type="radio" name="radioNoLabel" id="radioNoLabel2" value="" aria-label="..." />
</div>
<div class="rounded border d-flex w-100 p-3 align-items-center">
<p class="mb-0"><i class="fab fa-cc-mastercard fa-lg text-dark pe-2"></i>Online Banking</p>
</div>
</div>
<!-- Payment Method 3 -->
<div class="d-flex flex-row pb-3">
<div class="d-flex align-items-center pe-2">
<input class="form-check-input" type="radio" name="radioNoLabel" id="radioNoLabel2" value="" aria-label="..." />
</div>
<div class="rounded border d-flex w-100 p-3 align-items-center">
<p class="mb-0"><i class="fab fa-cc-mastercard fa-lg text-dark pe-2"></i>Paypal</p>
</div>
</div>
</div>
<form action="UserPayment.php" method="post">
<button type="submit" name="updateMembership" class="btn btn-primary btn-block btn-lg" >Proceed to Payment</button>
<input type="text" name="membership_id" value="<?php echo $membership["membership_id"]; ?>" class="btn btn-primary btn-block btn-lg" hidden/>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer id="footer" class="footer">
<div class="container footer-top">
<div class="row gy-4">
<div class="col-lg-5 col-md-12 footer-about">
<a href="Membership.php" class="logo d-flex align-items-center"><span>Steam Gaming</span></a>
<p>Your all-in-one gaming platform.</p>
<div class="social-links d-flex mt-4">
<a href="https://store.steampowered.com/"><i class="bi bi-steam"></i></a>
<a href="https://twitter.com/Steam"><i class="bi bi-twitter"></i></a>
<a href="https://www.instagram.com/steamgamingofficial/"><i class="bi bi-instagram"></i></a>
<a href="https://www.facebook.com/Steam/"><i class="bi bi-facebook"></i></a>
</div>
</div>
<div class="col-lg-2 col-6 footer-links">
<h4>Useful Links</h4>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="Store.php">Store</a></li>
<li><a href="Membership.php">Membership</a></li>
<li><a href="About.php">About</a></li>
</ul>
</div>
<div class="col-lg-2 col-6 footer-links">
<h4>Our features</h4>
<ul>
<li><a></a></li>
<li><a>Game List</a></li>
<li><a>Game Pass</a></li>
<li><a>Game News</a></li>
</ul>
</div>
<div class="col-lg-3 col-md-12 footer-contact text-center text-md-start">
<h4>Contact Us</h4>
<p>Technology Mara University,</p>
<p>02600, Arau, Perlis,</p>
<p>Malaysia.</p>
<p class="mt-4"><strong>Phone:</strong> <span>+60 12 345 6789</span></p>
<p><strong>Email:</strong> <span>steamgaming@email.com</span></p>
</div>
</div>
</div>
<!-- We keep this section for copyright purpose-->
<!--<div class="container copyright text-center mt-4">-->
<!--<p>© <span>Copyright</span> <strong class="px-1">Append</strong> <span>All Rights Reserved</span></p>-->
<!--<div class="credits">-->
<!-- All the links in the footer should remain intact. -->
<!-- You can delete the links only if you've purchased the pro version. -->
<!-- Licensing information: https://bootstrapmade.com/license/ -->
<!-- Purchase the pro version with working PHP/AJAX contact form: [buy-url] -->
<!--Designed by <a href="https://bootstrapmade.com/">BootstrapMade</a>-->
<!--</div>-->
<!--</div>-->
</footer>
<!-- Scroll Top Button -->
<a href="#" id="scroll-top" class="scroll-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>
<!-- Preloader -->
<div id="preloader">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<!-- Import JS Files -->
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets/vendor/glightbox/js/glightbox.min.js"></script>
<script src="assets/vendor/purecounter/purecounter_vanilla.js"></script>
<script src="assets/vendor/isotope-layout/isotope.pkgd.min.js"></script>
<script src="assets/vendor/swiper/swiper-bundle.min.js"></script>
<script src="assets/vendor/aos/aos.js"></script>
<script src="assets/vendor/php-email-form/validate.js"></script>
<!-- Import Main JS Files -->
<script src="views/userpayment/main.js"></script>
<script>
<?php if (isset($message))
{
if ($message === true) {
echo "showSweetAlertBuySuccess();";
} elseif ($message === false) {
echo "showSweetAlertBuyFailed();";
}
$message = null;
} ?>
</script>
<script>
function showSweetAlertBuySuccess()
{
Swal.fire({
position: "center",
icon: "success",
title: "Done Payment!",
text: 'Payment Successful.',
showConfirmButton: false,
timer: 5000
});
}
function showSweetAlertBuyFailed()
{
Swal.fire({
position: "center",
icon: "error",
title: "Payment Not Completed!",
text: 'Payment Unsuccessful.',
showConfirmButton: false,
timer: 5000
});
}
</script>
</body>
</html>