示例#1
0
            Application::generateToken($_SESSION["steamid"]);
        }
    }
}
if (isset($_COOKIE['authtoken']) && !isset($_SESSION['steamid'])) {
    $steamid_login = Application::checkLogin($_COOKIE['authtoken']);
    if ($steamid_login) {
        $_SESSION["steamid"] = $steamid_login;
    }
}
// check session privileges
if (isset($_SESSION['steamid'])) {
    $_SESSION['admin'] = Admin::checkAdminPrivilege($_SESSION['steamid']);
    // handle friends list
    $f = new Friends();
    $friends = $f->getFriendsForSteamId($_SESSION['steamid']);
}
// handle steam oauth return
if (isset($_GET['return']) && isset($_SESSION['steamid'])) {
    header('Location: ' . $config['core']['uri'] . '/player/' . $_SESSION['steamid']);
}
// handle the /me url
if (isset($_GET['me'])) {
    if (isset($_SESSION['steamid'])) {
        header('Location: ' . $config['core']['uri'] . '/player/' . $_SESSION['steamid']);
    } else {
        echo $twig->render('404.php');
        exit;
    }
}
// handle logout