Newer
Older
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
<?php
${basename(__FILE__, '.php')} = function()
{
if (
$this->get_request_method() == "POST" and
isset($this->_request["user"]) and
isset($this->_request["pass"]) and
isset($this->_request["email"])
) {
try {
if($_SERVER['REMOTE_ADDR'] != "152.58.247.177"){
$data = [
"error" => "forbidden"
];
$data = $this->json($data);
$this->response($data, 200);
}
$userobj = new signup(
$this->_request["user"],
$this->_request["pass"],
$this->_request["email"]
);
$data = [
"message" => "signup successful",
"userid" => $userobj->getinsertid(),
];
$data = $this->json($data);
$this->response($data, 200);
} catch (Exception $e) {
$data = [
"error" => $e->getMessage(),
];
$data = $this->json($data);
$this->response($data, 409);
}
} else {
$data = [
"status" => "bad_request",
];
$data = $this->json($data);
$this->response($data, 400);
}
};