Example #1
0
$tpl->assign('attempts', isset($_SESSION['attempts']) ? $_SESSION['attempts'] : 0);
if (isset($_GET['a'])) {
    $param = preg_split('/\\//', $_GET['a']);
    array_unshift($param, "");
} else {
    if (isset($_SERVER['PATH_INFO'])) {
        $param = preg_split('/\\//', $_SERVER['PATH_INFO']);
    }
}
unset($param[0]);
if (count($param) > 0 && $param[1] == 'logout' && $param[2] == 1) {
    // We're going to logout
    session_destroy();
    $tpl->assign('login', true);
    $tpl->setTemplate('admin/admin_index.tpl');
    $tpl->displayTemplate();
} else {
    if (session_id() == '') {
        session_start();
    }
    if (!isset($_SESSION['attempts'])) {
        $_SESSION['attempts'] = 0;
    }
    if (!isset($_SESSION['loggedIn'])) {
        $tpl->setTemplate('admin/admin_index.tpl');
        if ($_SESSION['attempts'] > 2) {
            // To many attempts
            echo 'aantal pogingen is te groot, uw account wordt geblokkeerd!';
            //Todo: Block user in db
            $_SESSION['attempts'] = 0;
        } else {