config; // Start database connection $database = new Database($config['database']); // Session wrapper $session = new Session; // Handles current user session $user = new User($session, $database); // 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($user, $config['root_url']); $app = new App( $config, $database, $session, $user ); // We will use $app instead unset( $config, $database, $session, $user ); return $app;