Example #1
0
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
if (isset($_GET['logout'])) {
    //Application::removeToken($_COOKIE['authtoken']);
    Application::removeAllTokens($_SESSION['steamid']);
    unset($_COOKIE['authtoken']);
    setcookie('authtoken', '', time() - 3600);
    session_destroy();
    session_unset();
    header('Location: ' . $config['core']['uri']);
}
// ready controllers
$controllers = array();
foreach (glob('controllers/*.php') as $controller) {
    preg_match('/controllers\\/(\\w+)\\.php/xi', $controller, $match);
    $controllers[] = $match[1];
}
// route requests
if (isset($_GET['do'])) {
    if (array_search($_GET['do'], $controllers) === false) {