$auth = new Auth(); $auth->setInstance($_DB->sql(DB_DEFAULT), "user_main", array("login", "password")); $auth->setFctToHashCookie(function ($password) { return password_hash($password . $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR'], PASSWORD_DEFAULT); }); $auth->authenticate(false); FactoryController::addDi("auth", $auth); } ENVIRONEMENT ? $_DEBUG->save("User connexion") : ""; $_SYSTEM['controller'] = \Glial\Utility\Inflector::camelize($url['controller']); $_SYSTEM['action'] = $url['action']; $_SYSTEM['param'] = $url['param']; $acl = new Acl(CONFIG . "acl.config.ini"); FactoryController::addDi("acl", $acl); $js = new Javascript(); FactoryController::addDi("js", $js); if ($acl->checkIfResourceExist($_SYSTEM['controller'] . "/" . $_SYSTEM['action'])) { if (AUTH_ACTIVE) { if (!$acl->isAllowed($auth->getAccess(), $_SYSTEM['controller'] . "/" . $_SYSTEM['action'])) { if ($auth->getAccess() == 1) { $url = ROUTE_LOGIN; $msg = $_SYSTEM['controller'] . "/" . $_SYSTEM['action'] . "<br />" . __("You have to be registered to acces to this page"); } else { //die("here"); $url = ROUTE_DEFAULT; $msg = $_SYSTEM['controller'] . "/" . $_SYSTEM['action'] . "<br />" . __("Your rank to this website is not enough to acess to this page"); } set_flash("error", __("Acess denied"), __("Acess denied") . " : " . $msg); header("location: " . LINK . $url); exit; }