-
Notifications
You must be signed in to change notification settings - Fork 0
/
userDashboardCancelTicket - Copy.php
315 lines (186 loc) · 8.95 KB
/
userDashboardCancelTicket - Copy.php
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
<?php session_start();
if(!isset($_SESSION["username"]))
{
header("Location:blocked.php");
$_SESSION['url'] = $_SERVER['REQUEST_URI'];
}
?>
<!DOCTYPE html>
<html lang="en">
<!-- HEAD TAG STARTS -->
<head>
<meta charset="UTF-8">
<meta name="author" content="Joydeep Dev Nath">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="shortcut icon" href="images/favicon.ico">
<title>Dashboard | Project Meteor</title>
<link href="css/main.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-select.css" rel="stylesheet">
<link href="css/bootstrap-datetimepicker.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Oswald:200,300,400|Raleway:100,300,400,500|Roboto:100,400,500,700" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/userDashboard.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-select.js"></script>
<script src="js/bootstrap-dropdown.js"></script>
<script src="js/jquery-2.1.1.min.js"></script>
<script src="js/moment-with-locales.js"></script>
<script src="js/bootstrap-datetimepicker.js"></script>
</head>
<!-- HEAD TAG ENDS -->
<!-- BODY TAG STARTS -->
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "projectmeteor";
// Creating a connection to projectmeteor MySQL database
$conn = new mysqli($servername, $username, $password, $dbname);
// Checking if we've successfully connected to the database
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
<body>
<div class="container-fluid">
<div class="col-sm-12 userDashboard text-center">
<?php include("common/headerDashboardTransparentLoggedIn.php"); ?>
<div class="col-sm-12">
<div class="heading text-center">
My Dashboard
</div>
</div>
<div class="col-sm-1"></div>
<div class="col-sm-3 containerBoxLeft">
<a href="userDashboardProfile.php">
<div class="col-sm-12 menuContainer bottomBorder">
<span class="fa fa-user-o"></span> My Profile
</div>
</a>
<a href="userDashboardBookings.php">
<div class="col-sm-12 menuContainer bottomBorder">
<span class="fa fa-copy"></span> My Bookings
</div>
</a>
<a href="userDashboardETickets.php">
<div class="col-sm-12 menuContainer bottomBorder">
<span class="fa fa-clone"></span> My E-Tickets
</div>
</a>
<div class="col-sm-12 menuContainer bottomBorder active">
<span class="fa fa-close"></span> Cancel Ticket
</div>
<a href="userDashboardAccountSettings.php">
<div class="col-sm-12 menuContainer noBottomBorder">
<span class="fa fa-bar-chart"></span> Account Stats
</div>
</a>
</div>
<div class="col-sm-7 containerBoxRight">
<?php
$user = $_SESSION["username"];
$flightBookingsSQL = "SELECT COUNT(*) FROM `flightbookings` WHERE Username='$user' AND cancelled='no'";
$flightBookingsQuery = $conn->query($flightBookingsSQL);
$noOfFlightBookings = $flightBookingsQuery->fetch_array(MYSQLI_NUM);
/*---------------------------------------------------------------------
ADD SIMILAR SQL STATEMENTS TO COUNT NO. OF TRAINS, BUSES, CABS BOOKINGS
AND HOTELS
---------------------------------------------------------------------*/
?>
<div class="col-sm-12 tickets">
<div class="col-sm-6 ticketsWrapper topMargin">
<div class="tagLeft">Select the type of ticket: </div>
</div>
<div class="col-sm-6 topMargin pullLeft">
<select class="input" name="ticketTypeSelector" id="ticketTypeSelector"/>
<option value="flightTickets">Flight Tickets (<?php echo $noOfFlightBookings[0]; ?>)</option>
<option value="trainTickets">Train Tickets (<?php echo "0" ?>)</option> <!-- change echo -->
<option value="busTickets">Bus Tickets (<?php echo "0" ?>)</option> <!-- change echo -->
<option value="cabTickets">Cab Tickets (<?php echo "0" ?>)</option> <!-- change echo -->
</select>
</div>
<?php if($noOfFlightBookings[0]>0): ?>
<!-------------------------------------------------------------------------------------------------
FLIGHT TICKETS SECTION STARTS
--------------------------------------------------------------------------------------------------->
<div class="col-sm-12 ticketTableContainer pullABitLeft" id="flightTicketsWrapper">
<table class="table table-responsive">
<thead>
<tr>
<th class="tableHeaderTags text-center" style="vertical-align: middle;">Id</th>
<th class="tableHeaderTags text-center" style="vertical-align: middle;">Origin</th>
<th class="tableHeaderTags text-center" style="vertical-align: middle;">Destination</th>
<th class="tableHeaderTags text-center" style="vertical-align: middle;">Date</th>
<th class="tableHeaderTags text-center" style="vertical-align: middle;">Type</th>
<th class="tableHeaderTags text-center" style="vertical-align: middle;">Ticket</th>
</tr>
</thead>
<?php
$flightTicketsSQL = "SELECT * FROM `flightbookings` WHERE username='$user' AND cancelled='no'";
$flightTicketsQuery = $conn->query($flightTicketsSQL);
while($flightTicketsRow = $flightTicketsQuery->fetch_assoc()) {
$modeDB=$flightTicketsRow["type"];
if($modeDB=="OneWayFlight") {
$modePrint="One Way";
}
else if($modeDB=="ReturnTripFlight") {
$modePrint="Return Trip";
}
?>
<tr>
<td class="tableElementTags text-center"><?php echo $flightTicketsRow["bookingID"]; ?></td>
<td class="tableElementTags text-center"><?php echo $flightTicketsRow["origin"]; ?></td>
<td class="tableElementTags text-center"><?php echo $flightTicketsRow["destination"]; ?></td>
<td class="tableElementTags text-center"><?php echo $flightTicketsRow["date"]; ?></td>
<td class="tableElementTags text-center"><?php echo $modePrint; ?></td>
<td class="text-center"><span class="fa fa-remove tableElementTags pullSpan"></span></td>
</tr>
<?php } ?>
</table>
</div>
<?php else: ?>
<div class="col-sm-12 ticketTableContainer" id="flightTicketsWrapper">
<div class="noBooking">
Looks like you haven't booked any flight with us yet. This area will list all your flight bookings once you start booking flights.
</div>
</div>
<?php endif; ?>
<!-------------------------------------------------------------------------------------------------
FLIGHT TICKETS SECTION ENDS
--------------------------------------------------------------------------------------------------->
<?php if(1==2): ?> <!-- change the condition -->
<!-------------------------------------------------------------------------------------------------
TRAIN TICKETS SECTION STARTS
--------------------------------------------------------------------------------------------------->
<div class="col-sm-12 ticketTableContainer" id="trainTicketsWrapper">
Here's the train tickets
</div>
<?php else: ?>
<div class="col-sm-12 ticketTableContainer" id="trainTicketsWrapper">
<div class="noBooking">
Looks like you haven't booked any train with us yet. This area will list all your train bookings once you start booking trains.
</div>
</div>
<?php endif; ?>
<!-------------------------------------------------------------------------------------------------
TRAIN TICKETS SECTION ENDS
--------------------------------------------------------------------------------------------------->
<div class="col-sm-12 ticketTableContainer" id="busTicketsWrapper">
Here's the bus tickets
</div>
<div class="col-sm-12 ticketTableContainer" id="cabTicketsWrapper">
Here's the cab tickets
</div>
</div>
</div>
<div class="col-sm-1"></div>
<div class="col-sm-12 spacer">a</div>
<div class="col-sm-12 spacer">a</div>
</div>
</div> <!-- container-fluid -->
<?php include("common/footer.php"); ?>
</body>
<!-- BODY TAG ENDS -->
</html>