config; // start database connection $database = new Database($config['database']); // session wrapper $session = new Session(); // handles current user session $user = new User($session, $database); $app = new App(__DIR__, $config, $database, $session, $user); // we will use $app instead unset($config, $database, $session, $user); /** * This is important! * Without it, everyone will have access to any page without having to be logged in. * * Decides if the user is allowed to view current page. */ new AccessControl($app->user, $app->config['root_url']); return $app;