-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_flights.php
188 lines (184 loc) · 8.5 KB
/
my_flights.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
<?php include_once 'helpers/helper.php'; ?>
<!-- log on to freeprojectscodes.com for more projects -->
<?php subview('header.php'); ?>
<?php if(isset($_SESSION['userId'])) {
require 'helpers/init_conn_db.php';
?>
<style>
body {
background: #bdc3c7; /* fallback for old browsers */
background: -webkit-linear-gradient(to right, #2c3e50, #bdc3c7); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right, #2c3e50, #bdc3c7); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
@font-face {
font-family: 'product sans';
src: url('assets/css/Product Sans Bold.ttf');
}
div.out {
padding: 30px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
border-top-left-radius: 20px;
border-bottom-right-radius: 20px;
}
.city {
font-size: 24px;
}
p {
margin-bottom: 10px;
font-family: product sans;
}
.alert {
/* font-family: 'Courier New', Courier, monospace; */
font-weight: bold;
}
.date {
font-size: 24px;
}
.time {
font-size: 27px;
margin-bottom: 0px;
}
.stat {
font-size: 17px;
}
h1 {
font-weight: lighter !important;
font-size: 45px !important;
margin-bottom: 20px;
font-family :'product sans' !important;
font-weight: bolder;
}
.row {
background-color: white;
}
@font-face {
font-family: 'product sans';
src: url('assets/css/Product Sans Bold.ttf');
}
</style>
<main><!-- log on to freeprojectscodes.com for more projects -->
<div class="container">
<h1 class="text-center text-light mt-4 mb-4">FLIGHT STATUS</h1>
<?php
$stmt_t = mysqli_stmt_init($conn);
$sql_t = 'SELECT * FROM Ticket WHERE user_id=?';
$stmt_t = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt_t,$sql_t)) {
header('Location: ticket.php?error=sqlerror');
exit();
} else {
mysqli_stmt_bind_param($stmt_t,'i',$_SESSION['userId']);
mysqli_stmt_execute($stmt_t);
$result_t = mysqli_stmt_get_result($stmt_t);
while($row_t = mysqli_fetch_assoc($result_t)) {
$stmt = mysqli_stmt_init($conn);
$sql = 'SELECT * FROM Passenger_profile WHERE passenger_id=?';
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt,$sql)) {
header('Location: my_flights.php?error=sqlerror');
exit();
} else {
mysqli_stmt_bind_param($stmt,'i',$row_t['passenger_id']);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
if ($row = mysqli_fetch_assoc($result)) {
$sql_f = 'SELECT * FROM Flight WHERE flight_id=? ';
$stmt_f = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt_f,$sql_f)) {
header('Location: my_flights.php?error=sqlerror');
exit();
} else {
mysqli_stmt_bind_param($stmt_f,'i',$row_t['flight_id']);
mysqli_stmt_execute($stmt_f);
$result_f = mysqli_stmt_get_result($stmt_f);
if($row_f = mysqli_fetch_assoc($result_f)) {
$date_time_dep = $row_f['departure'];
$date_dep = substr($date_time_dep,0,10);
$time_dep = substr($date_time_dep,10,6) ;
$date_time_arr = $row_f['arrivale'];
$date_arr = substr($date_time_arr,0,10);
$time_arr = substr($date_time_arr,10,6) ;
if($row_f['status'] === '') {
$status = "Not yet Departed";
$alert = 'alert-primary';
} else if($row_f['status'] === 'dep') {
$status = "Departed";
$alert = 'alert-info';
} else if($row_f['status'] === 'issue') {
$status = "Delayed";
$alert = 'alert-danger';
} else if($row_f['status'] === 'arr') {
$status = "Arrived";
$alert = 'alert-success';
}
echo '
<div class="row out mb-5 ">
<div class="col-md-4 order-lg-3 order-md-1"> ';
if($row_f['status'] === 'arr') {
echo '
<div class="row">
<div class="col-1 p-0 m-0">
<i class="fa fa-circle mt-4 text-success"
style="float: right;"></i>
</div>
<div class="col-10 p-0 m-0 mt-3" style="float: right;">
<hr class="bg-success">
</div>
<div class="col-1 p-0 m-0">
<i class="fa fa-2x fa-fighter-jet mt-3 text-success"
></i>
</div>
</div>
';
} else {
echo '
<div class="row">
<div class="col-1 p-0 m-0">
<i class="fa fa-2x fa-fighter-jet mt-3 text-success"
style="float: right;"></i>
</div>
<div class="col-10 p-0 m-0 mt-3" style="float: right;">
<hr style="background-color: lightgrey;">
</div>
<div class="col-1 p-0 m-0">
<i class="fa fa-circle mt-4"
style="color: lightgrey;"></i>
</div>
</div>
';
}
echo '
</div>
<div class="col-md-3 col-6 order-md-2 pl-0 text-center
order-lg-2 card-dep">
<p class="city">'.$row_f['source'].'</p>
<p class="stat">Scheduled Departure:</p>
<p class="date">'.$date_dep.'</p>
<p class="time">'.$time_dep.'</p>
</div>
<div class="col-md-3 col-6 order-md-4 pr-0 text-center
order-lg-4 card-arr"
style="float: right;">
<p class="city">'.$row_f['Destination'].'</p>
<p class="stat">Scheduled Arrival:</p>
<p class="date">'.$date_arr.'</p>
<p class="time">'.$time_arr.'</p>
</div>
<div class="col-lg-2 order-md-12">
<div class="alert '.$alert.' mt-5 text-center"
role="alert">
'.$status.'
</div>
</div>
</div> ';
}
}
}
}
}
}
?>
</div>
</main>
<?php } ?>
<?php subview('footer.php'); ?>