示例#1
0
require MODPATH . 'admin.captcha' . EXT;
$smarty = new Smarty();
session_start();
$route = RouteFactory::intance()->set('');
$error_msg = '';
if (isset($route['action'])) {
    if ($route['action'] == 'logout') {
        session_destroy();
        $home_url = '/admin';
        header('Location: ' . $home_url);
    }
}
if (isset($_SESSION['user'])) {
    $template_dir = TEMPLATES . 'templates' . DIRECTORY_SEPARATOR . 'admin';
    $smarty->template_dir = $template_dir;
    $smarty->assign(AdminFactory::intance()->getData(''));
    $smarty->assign(array('links' => array(), 'scripts' => array()));
    $smarty->assign(array('caption' => '后台管理平台'));
    $smarty->display('index.tpl');
} else {
    if ($_POST) {
        $captcha = trim($_POST['validateCode']);
        if (empty($captcha)) {
            $error_msg = '请输入验证码.';
        } else {
            $isdo = strtoupper($captcha) == strtoupper($_SESSION['captcha']);
            if ($isdo) {
                $user_username = trim($_POST['username']);
                $user_password = trim($_POST['password']);
                if (!empty($user_username) && !empty($user_password)) {
                    if (Model_Admin_Login::intance($user_username, $user_password)->login()) {
示例#2
0
文件: msgs.php 项目: azhai2015/weixin
<?php

defined('SYSPATH') or die('No direct script access.');
require SMARTY . 'Smarty.class' . EXT;
require MODPATH . 'admin.news' . EXT;
$smarty = new Smarty();
$template_dir = TEMPLATES . 'templates' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'msg';
$smarty->assign(AdminNewsFactory::intance()->getheader());
$smarty->assign(AdminFactory::intance()->getData('msgs'));
$smarty->assign(array('links' => array(), 'scripts' => array()));
if ($_GET) {
    $param = array('msg' => $_GET['msg'], 'goto' => $_GET['goto']);
}
$msgs = AdminFactory::intance()->getData('msg', $param);
$smarty->assign(array('caption' => '消息', 'msg' => $msgs, 'gotourl' => $param['goto']));
$smarty->template_dir = $template_dir;
$smarty->display('msg.tpl');