mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-01-15 21:07:57 -05:00
Adding a unit test to check the url patterns allowed/disallowed would be a good idea. I should practice what I preach.
17 lines
363 B
PHP
17 lines
363 B
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
function validate_method()
|
|
{
|
|
|
|
$url = $_SERVER['REQUEST_URI'];
|
|
|
|
$post_required = preg_match('/\/(save|delete*|remove*)\/?\d*?/', $url);
|
|
|
|
if($post_required && $_SERVER["REQUEST_METHOD"] != "POST" && empty($_POST))
|
|
{
|
|
echo "Method not allowed";
|
|
die;
|
|
}
|
|
|
|
}
|