</head> <body> <?php require_once 'Navigation.php'; require_once 'Authentication.php'; /* * Encode array into JSON */ function json($data) { if (is_array($data)) { return json_encode($data); } } $func = AuthenticationFactory::create(); if (is_null($func)) { echo "Nothing in login"; } else { $result = $func->RecoverAccount("*****@*****.**"); echo json($result); } // $func = AuthenticationFactory::create(); // if(is_null($func)) // echo "Nothing in login"; // else // echo json($func->IsAdminRegister()); // $nav = NavigationFactory::create(); // if(is_null($nav)) // echo "Nothing in Navigation"; // else
private function recoverAccount() { if ($this->get_request_method() != "POST") { $this->response('', 406); } $data = json_decode(file_get_contents("php://input"), true); $email = $data['email']; $func = AuthenticationFactory::create(); if (is_null($func)) { $this->response('', 406); } else { $result = $func->RecoverAccount($email); if ($result['status'] == "success") { $this->response($this->json($result), 200); } else { $this->response($this->json($result), 406); } } }