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
+6 -8
View File
@@ -14,17 +14,15 @@ if(isset($_POST['1Vote'])){
$vote->points += 1;
if(!empty($_POST['comment'])){
$vote->comment = $_POST['comment'];
}else{
header("location: ../../../Frontend/index.html?error=EmptyField");
exit();
}
$vote->save();
header("location: ../../../Frontend/index.html?success=YouHaveVoted");
exit();
if(!$vote->save()){
http_response_code(500);
}else{
http_response_code(201);
}
}
}else{
header("location: ../../../Frontend/index.html?error=YouCantVoted");
exit();
http_response_code(400);
}