if (!Auth::isLogged()) {
        return $response->withRedirect('/login');
    } else {
        require_once '../private/classes/Player.class.php';
        $datas = new Player();
        $datas = $datas->getListing(0, 10);
        return $this->view->render($response, 'index.html', ['head_title' => "Home", 'logged_status' => true, 'datas' => $datas]);
    }
});
// Login page
$app->map(['GET', 'POST'], '/login', function ($request, $response, $args) {
    if (!Auth::isLogged()) {
        if ($request->isPost()) {
            require_once '../private/classes/User.class.php';
            $co = new User();
            $return = $co->userLogin($_POST['username'], $_POST['password']);
            if ($return == true) {
                return $response->withRedirect('/');
            } else {
                return $this->view->render($response, 'login.html', ['head_title' => "Login", 'login_error' => true]);
            }
        } else {
            return $this->view->render($response, 'login.html', ['head_title' => "Login"]);
        }
    } else {
        return $response->withRedirect('/');
    }
})->setName('login');
// Logout page
$app->get('/logout', function ($request, $response, $args) {
    if (Auth::isLogged()) {
Example #2
0
                    $return = true;
                } else {
                    $alert = "注册失败!";
                }
            }
        }
        break;
    case "logout":
        $alert = "退出成功,3秒后返回!";
        $return = true;
        $user->userLogout();
        break;
    default:
    case "login":
        if (isset($_POST['submit'])) {
            if ($user->userLogin($_POST['user'], $_POST['pass'])) {
                $alert = "登录成功,3秒后返回!";
                $return = true;
            } else {
                $alert = "登录失败!";
            }
        }
        break;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>后台管理登录</title>
        <link rel="stylesheet" href="css/login.css" type="text/css" />
Example #3
0
<?php

echo 'ahoj som tu';
exit;
require_once 'include.php';
if (User::whoIsLogged()) {
    Utils::redirect('miestnosti.html');
}
if ($_POST['login']) {
    $error = User::userLogin();
    $GLOBALS['smarty']->assign('error', $error);
}
$GLOBALS['smarty']->assign('content', $GLOBALS['smarty']->fetch('login.tpl'));
echo $GLOBALS['smarty']->fetch('content.tpl');
Example #4
0
<?php 
require_once 'header.php';
if (isset($_GET['login'])) {
    echo "<div class='main'><h3>Введите данные для доступа</h3>";
    $error = $username = $password = "";
    if (isset($_POST['username'])) {
        $user = new User();
        $user->initFromPOST();
        $user->userLogin();
    }
    echo <<<_END
<div class="well">
\t\t\t\t\t\t<form method='post' action='index.php?login'>
\t\t\t\t\t\t\t<div class="form-group">
\t\t\t\t\t\t\t\t<label for="username">Логин</label>
\t\t\t\t\t\t\t\t<input type="text" class="form-control" id="username" name="username" placeholder="Ваш логин">
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div class="form-group">
\t\t\t\t\t\t\t\t<label for="password">Пароль</label>
\t\t\t\t\t\t\t\t<input type="password" class="form-control" id="password" name="password"
\t\t\t\t\t\t\t\tplaceholder="Ваш пароль">
\t\t\t\t\t\t\t\t<p class="help-block">проверьте правильность ввода данных</p>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<button type="submit" class="btn btn-default">Войти</button>
\t\t\t\t\t\t</form>
\t\t\t\t\t</div>
\t\t\t\t\t<BR>
</DIV>

_END;
    require_once "footer.php";