-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeleteFlight.php
254 lines (218 loc) · 7.25 KB
/
deleteFlight.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
<?php
require_once('db_connect.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600&display=swap" rel="stylesheet">
<title>Delete Flight | Admin</title>
<style>
/* Inline CSS for demonstration */
body {
margin: 0;
overflow: hidden;
background: linear-gradient(45deg, #BCC6CC, #98AFC7, #E8ADAA, #F2D4D7);
background-size: 400% 400%;
animation: gradient 15s infinite;
font-family: 'Open Sans', sans-serif;
}
@keyframes gradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
/* Additional styles for the content */
header, nav, section, footer {
padding: 15px;
}
header {
color: #FFFFF0;
text-align: center;
border: none;
font-weight: bold;
}
header h1 {
font-size: 30px;
margin-bottom: 5px;
color: blue;
font-weight: bold;
}
.logo-option {
display: flex;
align-items: center;
justify-content: center;
}
.logo-option img {
width: 80px;
margin-right: 10px;
}
.logo {
font-size: 20px;
}
.logo-img:hover {
transform: scale(1.1);
transition: transform 0.5s ease;
}
.logo-img:not(:hover) {
transform: scale(1);
transition: transform 0.5s ease;
}
.top-right-options {
position: absolute;
top: 15px;
right: 15px;
display: flex;
align-items: center;
}
.top-right-options a {
text-decoration: none;
color: #333; /* Dark gray color */
margin-right: 10px;
font-weight: bold;
transition: color 0.3s ease, background-color 0.3s ease;
padding: 5px 10px;
border-radius: 5px;
}
.top-right-options a:hover {
color: #FFFFF0; /* Change to text color */
background-color: #333; /* Dark gray color */
}
nav ul {
list-style: none;
}
nav li {
display: inline;
margin-right: 20px;
}
nav a {
text-decoration: none;
color: #FFFFF0;
margin-right: 10px;
font-weight: bold;
transition: color 0.3s ease, background-color 0.3s ease;
padding: 5px 10px;
border-radius: 5px;
transition: color 0.3s ease, background-color 0.3s ease;
}
nav a:hover {
color: #333;
background-color: #FFFFF0;
}
.content {
background-image: url('del.jpg');
background-size: cover;
background-position: center;
padding: 170px;
color: #333;
}
.options-section {
text-align: center;
margin-top: 50px;
}
.options-section a {
display: inline-block;
text-decoration: none;
background-color: #FFFFF0;
color: #333;
padding: 10px 20px;
margin: 0 10px;
border-radius: 5px;
font-weight: bold;
transition: background-color 0.3s ease, color 0.3s ease;
}
.options-section a:hover {
color: #FFFFF0;
background-color: #e73c7e;
}
.submit-button {
background-color: #333;
color: #FFFFF0;
border: none;
padding: 11px 30px;
border-radius: 5px;
transition: background-color 0.3s ease, color 0.3s ease;
}
.submit-button:hover {
background: linear-gradient(45deg, #E8ADAA, #98AFC7);
color: #333;
}
footer {
background-color: #333;
color: #FFFFF0;
text-align: center;
}
</style>
<script>
// Javascript
</script>
</head>
<body>
<div class="top-right-options">
<a href="SignOut.php">Sign Out</a>
<a href="#"><?php
if (isset($_SESSION['USER'])) {
echo "Welcome, " . $_SESSION['USER'] . "!";
} else {
echo "You are not logged in.";
}
?>
</a>
</div>
<header>
<div class="logo-option">
<a href="https://www.cristianoronaldo.com/brands"><img src="cr7logo.png" alt="Logo" class="logo-img"></a>
<div class="logo">CR7 Airlines</div>
</div>
</header>
<nav>
<ul>
<li><a href="admindashboard.php">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<section class="content">
<h2 style="color: #FFFFF0; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);">Delete Flight Schedule</h2>
<form action="" method="post" style="background-color: rgba(255, 255, 255, 0.788); padding: 50px; border-radius: 10px; width: 400px;">
<label for="flight_no" style="color: #333;"><b>Flight Number</b><br></label>
<input type="text" id="flight_no" name="flight_no"><br><br>
<button type="submit" class="submit-button" name="delete_flight"><b>Delete Flight(s)</b></button>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['delete_flight'])) {
if (isset($_POST['flight_no'])) {
$flight_no = $_POST['flight_no'];
// Delete from both tables where flight_no matches
$delete_query = "DELETE b, fd
FROM bookings AS b
JOIN flight_details AS fd ON b.flight_no = fd.flight_no
WHERE b.flight_no = '$flight_no'";
if (mysqli_query($conn, $delete_query)) {
if (mysqli_affected_rows($conn) > 0) {
echo "<br><br><b>Datas Associated with Flight Number $flight_no Deleted Successfully.</b>";
} else {
echo "<br><br><b style='color:red'>Flight Number Does Not Exist.</b>";
}
} else {
echo "Error: " . $delete_query . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
}
}
?>
</form>
</section>
<footer style="position: fixed; bottom: 0; left: 0; right: 0; background-color: #333; color: #FFFFF0; text-align: center; padding: 10px;">
<p>© <?php echo date("Y"); ?> CR7 Airlines</p>
</footer>
</body>
</html>