-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_requests.php
More file actions
108 lines (86 loc) · 3.26 KB
/
user_requests.php
File metadata and controls
108 lines (86 loc) · 3.26 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
<?php
$json = array();
include_once './db_functions.php';
include_once './gcm.php';
$db = new DB_Functions();
$gcm = new GCM();
$request = $_REQUEST["REQUEST"];
$result = 0;
switch ($request) {
/**
* Registering a user device & Store reg id in users table
*/
case "MOBILE_REGISTER":
if (isset($_REQUEST["name"]) && isset($_REQUEST["regId"])) {
$gcm_regid = $_REQUEST["regId"]; // GCM Registration ID
$name = $_REQUEST["name"];
$email = (isset($_REQUEST["email"])) ? $_REQUEST["email"] : "";
$phone_no = (isset($_REQUEST["phone_no"])) ? $_REQUEST["phone_no"] : "";
$res = $db->storeUser($gcm_regid, $email, $name, $phone_no);
$result = 1;
}
echo $result;
die();
return;
/**
* Unregister a user device
*/
case "MOBILE_UNREGISTER":
if (isset($_REQUEST["regId"])) {
$gcm_regid = $_REQUEST["regId"];
$result = $db->deleteUser($gcm_regid, $_REQUEST["email"]);
}
echo $result;
die();
return;
case "MOBILE_IS_REGISTERED":
if (isset($_REQUEST["regId"]))
$result = $db->userExists($_REQUEST["regId"], $_REQUEST["email"]);
echo $result;
die();
return;
case "MOBILE_SEARCH":
$result = - 1;
// check input params and pwd
$manifestID = (isset($_REQUEST["manifestID"])) ? $_REQUEST["manifestID"] : "";
$speditionID = (isset($_REQUEST["speditionID"])) ? $_REQUEST["speditionID"] : "";
$manifestPwd = (isset($_REQUEST["manifestPwd"])) ? html_entity_decode($_REQUEST["manifestPwd"]) : "";
if ($manifestID != "" && $speditionID != "" && $manifestPwd != "") {
$result = $db->searchManifest($manifestID, $speditionID, $manifestPwd);
}
echo $result;
die();
return;
case "MOBILE_EDIT_FLIGHT":
$result = - 1;
$speditionID = $_REQUEST["speditionID"];
$manifestID = $_REQUEST["manifestID"];
$awbTotal = $_REQUEST["mawb_nr"];
$flightNo = $_REQUEST["extinf_befoerderm_kz"];
$flightLoc = $_REQUEST["extinf_befoerderm_ladeort"];
if (isset($manifestID) && isset($speditionID) && isset($awbTotal) && isset($flightNo) && isset($flightLoc)) {
$awbTotal = explode("-", $awbTotal);
if (count($awbTotal) > 1) {
$result = $db->editFlight($speditionID, $manifestID, $awbTotal[0], $awbTotal[1], $flightNo, $flightLoc);
}
}
echo $result;
die();
return;
case "MOBILE_SUBMIT":
$result = - 1;
if (isset($_REQUEST["positions"]) && isset($_REQUEST["speditionID"]) && isset($_REQUEST["manifestID"])) {
$positions = json_decode($_REQUEST["positions"]);
$speditionID = $_REQUEST["speditionID"];
$manifestID = $_REQUEST["manifestID"];
if (isset($positions) && ! empty($positions)) {
$regId = isset($_REQUEST["regId"]) ? $_REQUEST["regId"] : null;
$name = isset($_REQUEST["name"]) ? $_REQUEST["name"] : null;
$result = $db->submitMrns($positions, $speditionID, $manifestID, $regId, $name);
}
}
echo $result;
die();
return;
}
?>