-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_booked_tickets.php
139 lines (137 loc) · 4.53 KB
/
view_booked_tickets.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
<?php
session_start();
?>
<html>
<head>
<title>
View Booked Tickets
</title>
<style>
input {
border: 1.5px solid #030337;
border-radius: 4px;
padding: 7px 30px;
}
input[type=submit] {
background-color: #030337;
color: white;
border-radius: 4px;
padding: 7px 45px;
margin: 0px 390px
}
table {
border-collapse: collapse;
margin-left: 10%;
margin-right: 10%;
}
tr/*:nth-child(3)*/ {
border: solid thin;
}
.set_nice_size{
font-size: 17pt;
}
</style>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<link rel="stylesheet" href="font-awesome-4.7.0\css\font-awesome.min.css">
</head>
<body>
<img class="logo" src="images/shutterstock_22.jpg"/>
<h1 id="title">
AADITH AIRLINES
</h1>
<div>
<ul>
<li><a href="customer_homepage.php"><i class="fa fa-home" aria-hidden="true"></i> Home</a></li>
<li><a href="customer_homepage.php"><i class="fa fa-desktop" aria-hidden="true"></i> Dashboard</a></li>
<li><a href="home_page.php"><i class="fa fa-plane" aria-hidden="true"></i> About Us</a></li>
<li><a href="home_page.php"><i class="fa fa-phone" aria-hidden="true"></i> Contact Us</a></li>
<li><a href="logout_handler.php"><i class="fa fa-sign-out" aria-hidden="true"></i> Logout</a></li>
</ul>
</div>
<h2>VIEW BOOKED FLIGHT TICKETS</h2>
<h3 class='set_nice_size'><center><u>Upcoming Trips</u></center></h3>
<?php
$todays_date=date('Y-m-d');
$thirty_days_before_date=date_create(date('Y-m-d'));
date_sub($thirty_days_before_date,date_interval_create_from_date_string("30 days"));
$thirty_days_before_date=date_format($thirty_days_before_date,"Y-m-d");
$customer_id=$_SESSION['login_user'];
require_once('Database Connection file/mysqli_connect.php');
$query="SELECT pnr,date_of_reservation,flight_no,journey_date,class,booking_status,no_of_passengers,payment_id FROM Ticket_Details where customer_id=? AND journey_date>=? AND booking_status='CONFIRMED' ORDER BY journey_date";
$stmt=mysqli_prepare($dbc,$query);
mysqli_stmt_bind_param($stmt,"ss",$customer_id,$todays_date);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt,$pnr,$date_of_reservation,$flight_no,$journey_date,$class,$booking_status,$no_of_passengers,$payment_id);
mysqli_stmt_store_result($stmt);
if(mysqli_stmt_num_rows($stmt)==0)
{
echo "<h3><center>No upcoming trips!</center></h3>";
}
else
{
echo "<table cellpadding=\"10\"";
echo "<tr><th>PNR</th>
<th>Date of Reservation</th>
<th>Flight No.</th>
<th>Journey Date</th>
<th>Class</th>
<th>Booking Status</th>
<th>No. of Passengers</th>
<th>Payment ID</th>
</tr>";
while(mysqli_stmt_fetch($stmt)) {
echo "<tr>
<td>".$pnr."</td>
<td>".$date_of_reservation."</td>
<td>".$flight_no."</td>
<td>".$journey_date."</td>
<td>".$class."</td>
<td>".$booking_status."</td>
<td>".$no_of_passengers."</td>
<td>".$payment_id."</td>
</tr>";
}
echo "</table> <br>";
}
echo "<br><h3 class=\"set_nice_size\"><center><u>Completed Trips</u></center></h3>";
$query="SELECT pnr,date_of_reservation,flight_no,journey_date,class,booking_status,no_of_passengers,payment_id FROM Ticket_Details where customer_id=? and journey_date<? and journey_date>=? ORDER BY journey_date";
$stmt=mysqli_prepare($dbc,$query);
mysqli_stmt_bind_param($stmt,"sss",$customer_id,$todays_date,$thirty_days_before_date);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt,$pnr,$date_of_reservation,$flight_no,$journey_date,$class,$booking_status,$no_of_passengers,$payment_id);
mysqli_stmt_store_result($stmt);
if(mysqli_stmt_num_rows($stmt)==0)
{
echo "<h3><center>No trips completed in the past 30 days!</center></h3>";
}
else
{
echo "<table cellpadding=\"10\"";
echo "<tr><th>PNR</th>
<th>Date of Reservation</th>
<th>Flight No.</th>
<th>Journey Date</th>
<th>Class</th>
<th>Booking Status</th>
<th>No. of Passengers</th>
<th>Payment ID</th>
</tr>";
while(mysqli_stmt_fetch($stmt)) {
echo "<tr>
<td>".$pnr."</td>
<td>".$date_of_reservation."</td>
<td>".$flight_no."</td>
<td>".$journey_date."</td>
<td>".$class."</td>
<td>".$booking_status."</td>
<td>".$no_of_passengers."</td>
<td>".$payment_id."</td>
</tr>";
}
echo "</table> <br>";
}
mysqli_stmt_close($stmt);
mysqli_close($dbc);
?>
</body>
</html>