-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_restaurant.php
48 lines (31 loc) · 1.09 KB
/
create_restaurant.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
<?php
require_once('Authentication.php');
$authentication = new Authentication();
$requestMethod = $_SERVER['REQUEST_METHOD'];
if ($requestMethod == "POST") {
try {
$json_string = file_get_contents("php://input");
$data = json_decode($json_string, true);
if (sizeof($data) > 4) {
$name = $data['name'];
$email = $data['email'];
$phone = $data['phone'];
$address = $data['address'];
$password = md5($authentication->check_input($data['password']));
$authentication = new Authentication();
if ($authentication->verifyEmail($email)) {
$authentication->registerUser($name, $email, $phone, $address, $password);
} else {
}
}
} catch (Exception $e) {
$message = json_encode(array("message" => "Bad Request $e", "status" => false));
http_response_code(400);
echo $message;
}
} else {
$message = json_encode(array("message" => "Bad Request", "status" => false));
http_response_code(400);
echo $message;
}
?>