Пример #1
0
        $cs = "";
        foreach ($snapshot->contacts as $c) {
            $tpl->set('contact', array('id' => $c['id'], 'name' => $c['name'], 'email' => $c['email']));
            $cs = $cs . $tpl->parse('contact');
        }
        $tpl->set('contacts', 'list', $cs);
        $tpl->set('main', 'content', $tpl->parse('contacts'));
        print $tpl->parse('main');
        break;
    case 'enter':
        $u = $_POST['user'];
        $p = $_POST['pass'];
        $gm->setLoginInfo($u, $p, 1.0);
        if ($gm->connect()) {
            $gm->saveCookieToBrowser();
            header("Location: ?mode=list");
        } else {
            die("f**k");
            header("Location: ?");
        }
        break;
    case 'logout':
        $gm->removeCookieFromBrowser();
        header("Location: ?");
        break;
    default:
        $tpl = new Templates('tpls');
        $tpl->set('main', 'content', $tpl->parse('login'));
        print $tpl->parse('main');
        break;
}