diff --git a/AbstractAction.php b/AbstractAction.php index 419822d..c08298c 100644 --- a/AbstractAction.php +++ b/AbstractAction.php @@ -5,6 +5,10 @@ namespace Sandpiper; abstract class AbstractAction { public abstract function handle(); + + public function get_request_method() { + return strtolower($_SERVER["REQUEST_METHOD"]); + } public function param_exists($key) { return !empty($_GET[$key]); diff --git a/Actions/Report.php b/Actions/Report.php index 44f5739..23342ca 100644 --- a/Actions/Report.php +++ b/Actions/Report.php @@ -20,6 +20,9 @@ class Report extends \Sandpiper\AbstractAction global $settings; header("content-type: text/plain"); + + if($this->get_request_method() !== "PUT") + \send_error(405, "Only PUT requests to this action are allowed."); if(!$this->param_exists("place_id")) exit("Error: No place id provided.\n");