-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddPlace.php
50 lines (35 loc) · 1.04 KB
/
addPlace.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
<?php
/**
* @author Taha
*/
require_once 'include/DB_Functions_Event.php';
$db = new DB_Functions_Event();
// json response array
$response = array("error" => FALSE);
if (isset($_POST['name'])) {
/*db->storeTestEvent();*/
// receiving the post params
$name = $_POST['name'];
if(isset($_POST['details'])) $details = $_POST['details'];
else $details = " ";
if(isset($_POST['link'])) $link = $_POST['link'];
else $link = " ";
$place = $db->storePlace($name, $details, $link);
if ($place) {
// event stored successfully
$response["error"] = FALSE;
echo json_encode($response);
} else {
// event failed to store
$response["error"] = TRUE;
$response["error_msg"] = "Unknown error occurred in storing event!";
/*db->storeTestEvent();*/
echo json_encode($response);
}
} else {
$response["error"] = TRUE;
$response["error_msg"] = "Required parameters are missing!";
/*db->storeTestEvent();*/
echo json_encode($response);
}
?>