diff options
| author | Syndamia <kamen@syndamia.com> | 2025-01-26 22:00:21 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2025-01-26 22:21:31 +0200 |
| commit | edf446fae669f3370609f5a955c3d6c863a93524 (patch) | |
| tree | c46984167cc5b79c51b243602f7a4837d428fd82 /controllers/meta.php | |
| parent | 73ad3e330be1a6849269fec5d4b7b42b0330cede (diff) | |
| download | nowayforward_human-edf446fae669f3370609f5a955c3d6c863a93524.tar nowayforward_human-edf446fae669f3370609f5a955c3d6c863a93524.tar.gz nowayforward_human-edf446fae669f3370609f5a955c3d6c863a93524.zip | |
feat: Replace sessionStorage with (custom) cookieStorage
Diffstat (limited to 'controllers/meta.php')
| -rw-r--r-- | controllers/meta.php | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/controllers/meta.php b/controllers/meta.php index e20bbfc..91a8ade 100644 --- a/controllers/meta.php +++ b/controllers/meta.php @@ -6,8 +6,18 @@ function call_handler(string $name) { } } -switch ($_SERVER['REQUEST_METHOD']) { - case 'POST': call_handler('Controller\on_post'); break; - case 'PUT': call_handler('Controller\on_put'); break; - case 'DELETE': call_handler('Controller\on_delete'); break; -}; +$TOKEN = (array_key_exists('token', $_COOKIE)) ? ($_COOKIE['token'] ?? "") : (""); + +function request_handler() { + if ($_SERVER['REQUEST_METHOD'] === 'POST') { + if (array_key_exists('method', $_POST)) { + switch ($_POST['method']) { + case 'PUT': call_handler('Controller\on_put'); return; + case 'DELETE': call_handler('Controller\on_delete'); return; + case 'PATCH': call_handler('Controller\on_patch'); return; + } + } + call_handler('Controller\on_post'); + } +} +request_handler(); |
