-
Notifications
You must be signed in to change notification settings - Fork 0
/
changeflight3.php
198 lines (165 loc) · 4.54 KB
/
changeflight3.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
<?php
session_start();
if(!isset($_SESSION['Admin']))
{
header("location: login.php");
}
require_once('Connection.php');
$flightno=$_SESSION['flight'];
$dep=$_POST['newdep'];
$des=$_POST['newdes'];
$date=$_POST['newdate'];
$time=$_POST['newtime'];
$eco_seat=$_POST['neweco_seat'];
$eco_price=$_POST['neweco_price'];
$preeco_seat=$_POST['newpreeco_seat'];
$preeco_price=$_POST['newpreeco_price'];
$first_seat=$_POST['newfirst_seat'];
$first_price=$_POST['newfirst_price'];
$bus_seat=$_POST['newbus_seat'];
$bus_price=$_POST['newbus_price'];
if(!empty($dep))
{
$query = "update flight set deperture='$dep' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
if(!empty($des))
{
$query = "update flight set destination='$des' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
if(!empty($date))
{
$query = "update flight set date='$date' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
if(!empty($time))
{
$query = "update flight set time='$time' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
if(!empty($eco_seat))
{
$query1="select* from seat where flightno='$flightno'";
$result= mysqli_query($con,$query1);
$row=mysqli_fetch_assoc($result);
$cur=$eco_seat-$row['eco_seat'];
$cur1=$row['cur_eco']+$cur;
if($cur1>=0){
$query = "update seat set eco_seat='$eco_seat', cur_eco='$cur1' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}else{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
if(!empty($eco_price))
{
$query = "update seat set eco_price='$eco_price' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
if(!empty($preeco_seat))
{
$query1="select* from seat where flightno='$flightno'";
$result= mysqli_query($con,$query1);
$row=mysqli_fetch_assoc($result);
$cur=$preeco_seat-$row['preeco_seat'];
$cur1=$row['cur_preco']+$cur;
if($cur1>=0){
$query = "update seat set preeco_seat='$preeco_seat',cur_preco='$cur1' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}else{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
if(!empty($preeco_price))
{
$query = "update seat set preeco_price='$preeco_price' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
if(!empty($first_seat))
{
$query1="select* from seat where flightno='$flightno'";
$result= mysqli_query($con,$query1);
$row=mysqli_fetch_assoc($result);
$cur=$first_seat-$row['first_seat'];
$cur1=$row['cur_first']+$cur;
if($cur1>=0){
$query = "update seat set first_seat='$first_seat', cur_first='$cur1' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}else{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
if(!empty($first_price))
{
$query = "update seat set first_price='$first_price' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
if(!empty($bus_seat))
{
$query1="select* from seat where flightno='$flightno'";
$result= mysqli_query($con,$query1);
$row=mysqli_fetch_assoc($result);
$cur=$bus_seat-$row['bus_seat'];
$cur1=$row['cur_bus']+$cur;
if($cur1>=0){
$query = "update seat set bus_seat='$bus_seat', cur_bus='$cur1' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}else{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
if(!empty($bus_price))
{
$query = "update seat set bus_price='$bus_price' where flightno='$flightno'";
$result= mysqli_query($con,$query);
if(!$result)
{
header("location:Changeflight2.php?Error=Something went wrong");
}
}
header("location:Changeflight2.php");