function logout(Application $app)
 {
     if ($app['currentUser']) {
         userLogOut();
         // We do this redirect so the page view can be set up again from fresh with the correct enviroment
         // Maybe we could store in the user session which user it was here ...
         return $app->redirect('/me/logout');
     } else {
         // ... so here we can get user out of the session and pass to template so goodbye message can be personalised?
         return $app['twig']->render('index/user/logout.html.twig', array());
     }
 }
Beispiel #2
0
    if (isset($_POST["nickname"]) && $_POST["nickname"] != stringDecode($user["nickname"])) {
        $params["nickname"] = $_POST["nickname"];
    }
    if (isset($_POST["email"]) && $_POST["email"] != stringDecode($user["email"])) {
        $params["email"] = $_POST["email"];
    }
    userSetParams($user["id"], $params);
    header("location: index.php?profile");
}
if (isset($_GET["login"])) {
    $res = userLogIn($_POST["login"], $_POST["password"], isset($_POST["remember"]));
    handleErrors($res);
    header("location: index.php");
}
if (isset($_GET["logout"])) {
    userLogOut();
    header("location: index.php");
}
if (isset($_GET["cap"])) {
    $x1 = rand(2, 50);
    $x2 = rand(1, $x1 - 1);
    $rnd = rand(0, 3);
    if ($rnd == 0) {
        $operation = " - ";
    } elseif ($rnd == 1) {
        $operation = " * ";
    } else {
        $operation = " + ";
    }
    $expression = $x1 . " " . $operation . " " . $x2;
    echo $expression . "<input type=\"hidden\" name=\"code\" value=\"" . stringEncode($expression) . "\" />";