Added http response code
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user