blob: 91a8ade72ebe27d53a407c2c2c1bdf629b55ccaa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?php
function call_handler(string $name) {
if (function_exists($name)) {
call_user_func($name);
}
}
$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();
|