public function add() { if (!isset($_SESSION['userId']) && $_SESSION['admin'] != true) { header('Location: /php_project/application/public/'); exit; } if (isset($_POST['name'])) { $cleaner = new \Framework\Common(); $newCat = array(); $newCat['name'] = $cleaner->normalize($_POST['name'], 'trim|xss|string'); $newCat['user_id'] = $_SESSION['userId']; $categoryDb = new \Models\Category(); $categoryDb->add($newCat); header('Location: /php_project/application/public/editor/index'); exit; } $this->view->appendToLayout('body', 'addPromotion'); $this->view->display('layouts.default'); }