Пример #1
0
    if (SECURITY_LEVEL == 0) {
        //停用認證
        $_SESSION['auth'] = true;
        $_SESSION['auth_uid'] = 'admin';
        $app->applyHook('account.login_success', 'admin');
        $app->redirect('./');
    }
    $app->render('login.html', $tpl);
});
$app->get('/logout', function () use($app) {
    session_destroy();
    $app->redirect('login');
});
$app->post('/login', function () use($app) {
    //block ip
    if (AUTH::is_block()) {
        $app->redirect('login');
    }
    $post = $app->request()->post();
    if (isset($post['uid']) && isset($post['pwd'])) {
        $uid = $post['uid'];
        $pwd = $post['pwd'];
        if ($uid == '' || $pwd == '') {
            $app->redirect('login');
        }
        $auth = new AUTH($uid);
        if ($auth->login($pwd) === true) {
            $_SESSION['auth'] = true;
            $_SESSION['auth_uid'] = $uid;
            $app->applyHook('account.login_success', $uid);
            $app->redirect('./');