Merge pull request #64 from ThomasRubini/redirect

This commit is contained in:
Thomas Rubini 2023-01-24 11:53:41 +01:00 committed by GitHub
commit b52d43ca6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -13,7 +13,8 @@ final class ApprController
$O_apprModel = new ApprModel();
$O_apprModel->createAppr($_SESSION["ID"], $I_recipe_id, $S_comment, $I_score);
header("Location: ".$_SERVER['HTTP_REFERER']);
}
public function deleteAction(Array $A_urlParams = null, Array $A_postParams = null)
@ -35,8 +36,6 @@ final class ApprController
$O_apprModel->deleteAppr($I_appr_id);
echo "Appreciation $I_appr_id supprimée avec succès";
header("Location: ".$_SERVER['HTTP_REFERER']);
}
}
}

View File

@ -44,8 +44,13 @@
}
if ($I_err_httpCode !== null) {
http_response_code($I_err_httpCode);
// do not disable redirects
if(http_response_code() !== 302) {
http_response_code($I_err_httpCode);
}
// Make the user see the error in these cases
if($I_err_httpCode === 500 || $I_err_httpCode === 400) {
header_remove("Location");
}