-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrew.php
More file actions
executable file
·151 lines (129 loc) · 4.32 KB
/
crew.php
File metadata and controls
executable file
·151 lines (129 loc) · 4.32 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
<html>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<head>
<style>
.container {
background: rgba(150, 190, 225, 0.35);
}
h3 {
color: #111; font-family: 'Georgia'
}
p {
color: #111; font-family: 'Tahoma'
}
</style>
</head>
<body>
<nav class="navbar navbar-inverse" data-spy="affix" data-offset-top= "200">
<div class="container-fluid">
<ul class="nav navbar-nav">
<li><a href="menu.php">Home</a></li>
<li><a href="cust.php">Customers</a></li>
<li class="active"><a href="crew.php">Flight Crew</a></li>
<li><a href="admin.php">Admin</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="login.html"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
</ul>
</div>
</nav>
<tr valign="top"><td width="40%">
<div class="container">
<div id="assnSearch">
<h3>View Flight Assignments</h3>
<form method="POST" action= <?php __FILE__ ?> >
<table>
<tr>
<td>Employee ID</td>
<td><label for="input-id" class="sr-only">0001</label>
<input type="number" name="eid" required placeholder="0001" id="input-id"></td>
</tr>
<tr>
<td><button type="submit" value="submit" name="searchFltAssnSubmit" class="btn btn-primary btn-md">Search</button></td>
</tr>
</table>
</form>
</div>
<div id="passengerSearch">
<h3>View Flight Passengers</h3>
<form method="POST" action= <?php __FILE__ ?> >
<table>
<tr>
<td>Flight Number</td>
<td><label for="input-id" class="sr-only">F000</label>
<input type="input" maxlength="4" name="fno" required placeholder="F000" id="input-id"></td>
</tr>
<tr>
<td>Departure Date</td>
<td><input type="date" name="dDate" required></td>
</tr>
<tr>
<td><button type="submit" value="submit" name="searchPassSubmit" class="btn btn-primary btn-md">Search</button></td>
</tr>
</table>
</form>
</div>
</td><td>
<?php
//error_reporting(-1);
//ini_set('display_errors',1);
date_default_timezone_set ('UTC');
$hasRequiredFields = false;
if (array_key_exists('searchFltAssnSubmit', $_POST)) {
$eid = "'".$_POST['eid']."'";
if ($eid !== "''") $hasRequiredFields = true;
$query = "select * from flight f where f.fno in (select c.fno from crewassn c where eid = $eid)";
} else if (array_key_exists('searchPassSubmit', $_POST)) {
$fno = "'".$_POST['fno']."'";
$dDate = "'".strtoupper(date('Y-m-d', strtotime($_POST['dDate'])))."'";
if ($fno !== "''" && $dDate !== "'1970-01-01'") $hasRequiredFields = true;
$query = "select * from flight where dateflight = $dDate and fno = $fno";
$query2 = "select p.pid, p.pname, t.tid from passenger p, ticket t where t.pid = p.pid and t.dateflight = $dDate and t.fno = $fno";
}
if ($hasRequiredFields) {
require('sqlfn.php');
$username = $_COOKIE['username'];
$password = $_COOKIE['password'];
$db_conn = dbConn($username, $password);
$result = executePlainSQL($query);
if (array_key_exists('searchPassSubmit', $_POST))
$result2 = executePlainSQL($query2);
OCICommit($db_conn);
dbDisconn($db_conn);
echo '<table border="3"><thead>'.
'<td><b>Flight No.</b></td>'.
'<td><b>Departure Airport</b></td>'.
'<td><b>Arrival Airport</b></td>'.
'<td><b>Departure Date</b></td>'.
'<td><b>Arrival Date</b></td>'.
'</thead>';
while ($row = OCI_Fetch_Array($result, OCI_BOTH)) {
echo "<tr align='center'>";
echo "<td>" . $row[0] . "</td>";
echo "<td>" . $row[3] . "</td>";
echo "<td>" . $row[6] . "</td>";
echo "<td>" . $row[1] . "</td>";
echo "<td>" . $row[4] . "</td>";
echo "</tr>";
}
echo '</table>';
if (array_key_exists('searchPassSubmit', $_POST)) {
echo '</br><table border="3"><thead>'.
'<td><b>Passenger ID</b></td>'.
'<td><b>Name</b></td>'.
'<td><b>Ticket ID</b></td>'.
'</thead>';
while ($row = OCI_Fetch_Array($result2, OCI_BOTH)) {
echo "<tr align='center'>";
echo "<td>" . $row[0] . "</td>";
echo "<td>" . $row[1] . "</td>";
echo "<td>" . $row[2] . "</td>";
echo "</tr>";
}
}
}
?>
</td></tr>
</body>
</html>