require 'routes.php'; require 'controllers.php'; //print_r($ROUTE); //print $_SERVER['REQUEST_METHOD']; if (isset($_SERVER['HTTP_X_TOKEN'])) { $token = $_SERVER['HTTP_X_TOKEN']; } else { $token = 0; } //print $token; if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($ROUTE[$_POST['function']]['method'] === 'POST') { if ($ROUTE[$_POST['function']]['url'] === 'deleteProduct') { $cont = new controllers(); $cont->deleteProduct($_POST, $token); } else { if ($ROUTE[$_POST['function']]['url'] === 'addProduct') { $cont = new controllers(); $cont->addProduct($_POST, $token); } else { if ($ROUTE[$_POST['function']]['url'] === 'searchProduct') { $cont = new controllers(); $cont->searchProduct($_POST, $token); } else { if ($ROUTE[$_POST['function']]['url'] === 'registration') { $cont = new controllers(); $cont->registration($_POST); } else { if ($ROUTE[$_POST['function']]['url'] === 'login') { $cont = new controllers();