-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax.php
127 lines (100 loc) · 2.77 KB
/
ajax.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
<?php
include 'db.php';
include 'functions.php';
// CLEAN AJAX
//$.ajax('ajax.php', {
// data: {"action":"},
// dataType: 'json'
//
// }).done(function(response) {
//
//
// }).fail(function() {
//
// });
$action = $_GET['action'];
if($action == 'login'){
login($_GET['email'], $_GET['password']);
}
if($action == 'logout'){
logout();
}
if($action == 'sign_up'){
signUp($_GET['first-name'], $_GET['last-name'], $_GET['phone-num'], $_GET['email'], $_GET['password']);
}
if($action == 'search_flights') {
searchFlights($_GET['flight_from'], $_GET['flight_to'], $_GET['date']);
}
if($action == 'select_flight') {
selectFlight($_GET['flight_id']);
}
if($action == 'display_user_bookings') {
displayUserBookings();
}
//
// if($action == 'check_session'){
// checkSession();
// }
//
// if($action == 'get_user_id'){
// echo getUserId();
// }
if($action == 'book_ticket'){
bookTicket($_GET['flight_id']);
}
if($action == 'is_user_logged_in') {
echo json_encode(getUserData());
}
if($action == 'edit_user_profile') {
editUserProfile();
}
if($action == 'update_user_profile') {
updateUserProfile($_GET['phone_num'], $_GET['email']);
}
if($action == 'change_password') {
changePassword($_GET['old_password'], $_GET['new_password']);
}
if($action == 'get_all_flights') {
getAdminAllFlights();
}
if($action == 'delete_flight') {
deleteFlight($_GET['flight_id']);
}
if($action == 'edit_flight') {
editFlight(
$_GET['flight_id'], $_GET['flight_no'],
$_GET['flight_from'], $_GET['flight_to'],
$_GET['departure_time'], $_GET['arrival_time'],
$_GET['price'], $_GET['economy_seats'], $_GET['business_seats']
);
}
if($action == 'create_flight') {
createFlight($_GET['flight_no'],
$_GET['flight_from'],
$_GET['flight_to'],
$_GET['departure_time'],
$_GET['arrival_time'],
$_GET['price'],
$_GET['economy_seats'],
$_GET['business_seats']
);
}
if($action == 'get_passengers') {
getPassengers($_GET['flight_id']);
}
if($action == 'cancel_booking') {
cancelBooking($_GET['booking_id']);
}
if($action == 'get_airports') {
getAirports();
}
if($action == 'generate_flights') {
generateFlights();
}
if($action == 'send_sms') {
sendSMS($_GET['flight_id']);
}
if($action=="generatePassengers"){
generatePassengers(100);
}
?>