exit;
        }
    } else {
        @header('location: login.php');
        exit;
    }
}
// log the hit
AuditAction($cfg["constants"]["hit"], $_SERVER['PHP_SELF']);
// if at this moment no user is set there is something wrong
if (!isset($currentUser) || empty($currentUser)) {
    @header('location: login.php');
    exit;
}
// cache is not set
if (!cacheIsSet($currentUser)) {
    // login-check-tasks
    if (!isset($_SESSION['login_tasks'])) {
        // check for setup.php
        if (!isset($_SESSION['check']['setup'])) {
            $_SESSION['check']['setup'] = 1;
            // check for setup.php and upgrade.php
            if (@file_exists("setup.php") === true) {
                @error("setup.php must be deleted", "index.php?iid=index", "");
            }
        }
        // check for upgrade.php
        if (!isset($_SESSION['check']['upgrade'])) {
            $_SESSION['check']['upgrade'] = 1;
            if (@file_exists("upgrade.php") === true) {
                @error("upgrade.php must be deleted", "index.php?iid=index", "");
    dbInitialize();
    // init cache
    cacheInit($_SESSION['user']);
    // init transfers-cache
    cacheTransfersInit();
} else {
    // main.core
    require_once 'inc/main.core.php';
    // set transfers-cache
    cacheTransfersSet();
}
// public-stats-switch
switch ($cfg['stats_enable_public']) {
    case 1:
        // load default-language and transfers if cache not set
        if (!isset($_SESSION['user']) || !cacheIsSet($_SESSION['user'])) {
            // common functions
            require_once 'inc/functions/functions.common.php';
            // lang file
            loadLanguageFile($cfg["default_language"]);
        }
        // Fluxd
        Fluxd::initialize();
        // Qmgr
        FluxdServiceMod::initializeServiceMod('Qmgr');
        // public stats... show all .. we set the user to superadmin
        $superAdm = GetSuperAdmin();
        if (isset($superAdm) && $superAdm != "") {
            $cfg["user"] = $superAdm;
            $cfg['isAdmin'] = true;
        } else {