Added http response code

This commit is contained in:
neerholt
2021-03-19 13:25:27 +01:00
parent 409556ca2e
commit 171e0a3765
18 changed files with 103 additions and 112 deletions
+4 -8
View File
@@ -10,17 +10,13 @@ if (isAdmin()){
$admin->user_name = $_POST["newUsername"];
$admin->password = $_POST["newPassword"];
if ($admin->save()){
header("location: ../../../Frontend/Html/AdminPage.html?success=adminUserWasCreated");
exit();
http_response_code(201);
}else{
header("location: ../../../Frontend/Html/AdminPage.html?error=errorWhileSaving");
exit();
http_response_code(500);
}
}else{
header("location: ../../../Frontend/Html/AdminPage.html?error=input:newAdmin.notSet");
exit();
http_response_code(400);
}
}else{
header("location: ../../../Frontend/index.html?error=isNotAdministrator");
exit();
http_response_code(401);
}