<?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); } };