article generator throws 405 on non-post

This commit is contained in:
Zdenek Borovec 2024-07-31 07:09:35 +02:00
parent c785235e81
commit 8a717ca0e9

View file

@ -149,6 +149,15 @@ function load_blog($conn, $blogId){
$datePosted, $dateEdited, $tags, $comments); $datePosted, $dateEdited, $tags, $comments);
} }
// If request is not POST, throw method not allowed
if(strcmp($_SERVER["REQUEST_METHOD"], "POST") != 0)
{
header($_SERVER["SERVER_PROTOCOL"]." 405 Method Not Allowed", true, 405);
include_once($_SERVER["DOCUMENT_ROOT"]."/errors/405.php");
include_once($COMMONS."/footer.php");
die();
}
// Check DB connection // Check DB connection
if($conn == null){ if($conn == null){
header($_SERVER["SERVER_PROTOCOL"]." 503 Service Unavailable", true, 503); header($_SERVER["SERVER_PROTOCOL"]." 503 Service Unavailable", true, 503);