Пример #1
0
            die;
        } else {
            /* DO SOMETHING IN THAT CASE */
        }
    }
}
/* If this is not index.php and request was not authorized, cut it loose */
if ($_SESSION['id'] == "" and $_SESSION['key'] == "") {
    /* This is surely unauthorized session */
    if ($config['system_root'] . "index.php" != $_SERVER['SCRIPT_NAME']) {
        header("Location: " . $config['system_root']);
        die;
    }
}
/* Handle automatic relogin */
if ($_SESSION['login'] != "") {
    $userName = $DB->escapeData($_SESSION['login']);
    $userParameters = $DB->getData("users", "WHERE login='******'");
    if (count($userParameters) > 0) {
        $sessionCurrentStatus = $Auth->sessionVerify($userParameters[0]['password']);
    }
}
/* Reinstall the session if credentials was verified */
if ($sessionCurrentStatus) {
    $Auth->sessionRegenerate();
}
/* Handle manual log out */
if (isset($_GET['logout'])) {
    $Auth->sessionDestroy();
    header("Location: " . $config['system_root']);
}