article generator throws 405 on non-post

This commit is contained in:
Zdenek Borovec 2024-07-31 07:09:35 +02:00
parent e8b715de8d
commit d58562538f

View file

@ -149,6 +149,15 @@ function load_blog($conn, $blogId){
$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
if($conn == null){
header($_SERVER["SERVER_PROTOCOL"]." 503 Service Unavailable", true, 503);