コード例 #1
0
 public function __construct()
 {
     if ($_GET['source'] && !cookie('source')) {
         cookie('source', trim($_GET['source']));
     }
     if (isset($_GET['spm']) && $_GET['spm']) {
         cookie('_spm', $_GET['spm'], array('expire' => 172800, 'domain' => '.wdwd.com', 'path' => '/'));
     }
     if (!session('?shop')) {
         $this->redirect('admin/passport/logout');
     }
     /*
     var_dump(session('shop'));
     exit;
     if (!session('?shop') || ('' == session('shop.mobile'))) {
         if (session('?user')) {
             $this->redirect('admin/passport/bind');
         }
         else {
             $this->redirect('admin/passport/logout');
         }
     }
     */
     $shop = session('shop');
     $shop['decode_shop_id'] = \Common\Lib\Idhandler::decode($shop['shop_id']);
     $this->passport = session('passport');
     $this->shop = $shop;
     $this->shop['mobile'] = $this->passport['loginname'];
     //print_r($this->shop);
     //print_r(session('passport'));
     parent::__construct();
 }
コード例 #2
0
 private function receiveEvent($object)
 {
     $contentStr = "";
     switch ($object->Event) {
         case "subscribe":
             $contentStr = "欢迎关注方倍工作室";
             cookie('openid', $object->FromUserName . '');
             break;
         case "unsubscribe":
             $contentStr = "";
             break;
         case "CLICK":
             switch ($object->EventKey) {
                 case "天气北京":
                     $contentStr = "北京天气晴!";
                     break;
                 default:
                     $contentStr = "你点击了菜单: " . $object->EventKey;
                     break;
             }
             break;
         default:
             $contentStr = "receive a new event: " . $object->Event;
             break;
     }
     $resultStr = $this->transmitText($object, $contentStr);
     return $resultStr;
 }
 public function rememberMe($userId, $password, $expire = 864000)
 {
     $token['userId'] = $userId;
     $token['verify'] = sha1(md5($password));
     cookie('token', $token, $expire);
     return 1;
 }
コード例 #4
0
 public function dealData()
 {
     $username = I('username', null, 'htmlspecialchars');
     $password = I('password', null, 'htmlspecialchars');
     $remember = I('checkbox', 0, 'htmlspecialchars');
     if ($username != null && $password != null) {
         $data = M()->table('Admin')->where(array('username' => $username))->find();
         if ($data['username'] == $username && $data['password'] == md5($password)) {
             $_SESSION['username'] = $username;
             $_SESSION['password'] = $password;
             $_SESSION['remember'] = $remember;
             M()->table('Admin')->where('id=1')->setField('logintime', time());
             if ($remember == 1) {
                 cookie('remember', $username . ":" . $password, time() + 3600 * 24);
             }
             $this->redirect("Index/index", array("tab" => 1));
         } else {
             echo "<script> alert('用户名或密码错误!');parent.location.href='index.html'; </script>";
             exit;
         }
     } else {
         if ($username == null) {
             echo "<script> alert('用户名不能为空!');parent.location.href='index.html'; </script>";
             exit;
         } else {
             if ($password == null) {
                 echo "<script> alert('密码不能为空!');parent.location.href='index.html'; </script>";
                 exit;
             }
         }
     }
 }
コード例 #5
0
 public function edit($id)
 {
     //get提交时 根据id查询出相应的数据进行回显
     if (IS_GET) {
         $rows = $this->model->find($id);
         //查询一条数据用find
         //分配数据到页面
         $this->assign($rows);
         $this->_edit_view_before();
         $this->assign("meta_title", "编辑{$this->meta_title}");
         //调用显示页面
         $this->display("edit");
     } else {
         //post提交时用create方法收集数据,并用save方法更新到数据库涨
         if ($this->model->create() !== false) {
             //有数据时进行更新操作
             if ($this->model->save($this->usePostParams ? I('post.') : '') !== false) {
                 //更新成功时跳转到cookie中保存的当前页面
                 $this->success("更新成功...", cookie("__nowurl__"));
                 return;
             }
             $this->error("更新失败.." . show_model_error($this->model));
         }
     }
 }
コード例 #6
0
 /**
  * 列表查询
  */
 public function getBrands()
 {
     $m = D('Home/Brands');
     $brandslist = $m->queryBrandsByDistrict();
     cookie("bstreesAreaId3", I("areaId3"));
     $this->ajaxReturn($brandslist);
 }
コード例 #7
0
 /**
  * 登录验证
  */
 public function loginCheck()
 {
     $name = $this->_post('name');
     $password = $this->_post('password');
     $user = M('user');
     $condition['name'] = $name;
     $data = $user->where($condition)->select();
     if ($data) {
         if ($data[0]['password'] == $password) {
             //验证成功
             session('user_id', $data[0]['id']);
             cookie('user_id', $data[0]['id'], 3600);
             //$this->display('Home:hometest');
             //$this->display('Home:home');
             header('location:' . $this->conf['APP_ROOT'] . 'Home/home');
         } else {
             //密码错误
             $message = '对不起,您的密码错误!';
             $this->assign('message', $message);
             $this->display('Login:loginFail');
         }
     } else {
         //用户名不存在
         $message = '对不起,用户名不存在!';
         $this->assign('message', $message);
         $this->display('Login:loginFail');
     }
 }
コード例 #8
0
 public function _initialize()
 {
     if (!session("user_id")) {
         if (!cookie("user_id")) {
             $user_id = D("User")->user_add();
             cookie("user_id", $user_id, 36000000);
             cookie("token", md5(C("cookie_key") . $user_id), 36000000);
             session("user_id", $user_id);
         } else {
             $user_id = cookie("user_id");
             $token = cookie("token");
             if (md5(C("cookie_key") . $user_id) == $token) {
                 session("user_id", $user_id);
                 cookie("user_id", $user_id, 36000000);
                 cookie("token", md5(C("cookie_key") . $user_id), 36000000);
             } else {
                 $user_id = D("User")->user_add();
                 cookie("user_id", $user_id, 36000000);
                 cookie("token", md5(C("cookie_key") . $user_id), 36000000);
                 session("user_id", $user_id);
             }
         }
     } else {
         $user_id = session("user_id");
     }
     $user = D("user")->getuser($user_id);
     define('UID', $user_id);
     define('NAME', $user['name']);
 }
コード例 #9
0
 /**
  * 修改菜单
  */
 public function edit($id)
 {
     $model = D('Menu');
     if (IS_POST) {
         if ($model->create()) {
             if ($model->updateMenu() !== false) {
                 $this->success('修改成功', cookie('forward'));
             } else {
                 $this->error('修改失败');
             }
         } else {
             $this->error(get_errors($model->getError()));
         }
     } else {
         //1.根据id获取数据表中的数据
         //获取所有的菜单
         $this->assign('all_menu', $model->getList(array('id,name,parent_id'), array(), true));
         //获取所有的权限
         //取出所有的权限
         $this->assign('all_permissions', D('Permission')->getList('id,name,parent_id', array(), true));
         //获取当前关联的权限
         $this->assign('perms', $model->getPermission($id, true));
         $row = $model->find($id);
         $this->assign('row', $row);
         $this->display();
     }
 }
コード例 #10
0
ファイル: UserApi.class.php プロジェクト: smilecc/MakerLab
 public function logout()
 {
     session('user_status', NULL);
     cookie('token', NULL);
     cookie('username', NULL);
     cookie('userid', NULL);
 }
コード例 #11
0
ファイル: UserAction.class.php プロジェクト: u0mo5/bookshop
 public function logout()
 {
     cookie('suid', null);
     session('user', null);
     session('login', null);
     header('Location: ' . __SHOP__);
 }
コード例 #12
0
 /**
  * 退出
  */
 public function logout()
 {
     session_regenerate_id();
     session(null);
     cookie(null);
     redirect(U('Login/index'));
 }
コード例 #13
0
 public function flow2()
 {
     if (!is_login()) {
         cookie('__forward__', __SELF__);
         $this->error('请先登录', U('Member/login'));
         return;
     }
     if (IS_POST) {
         $order_model = D('OrderInfo');
         if ($order_model->addOrder()) {
             $this->redirect('flow3');
         } else {
             $this->error('下单失败,请稍后再试');
         }
     } else {
         //用户地址列表
         $this->assign('address_list', D('Address')->getAddList());
         //获取支付方式
         $this->assign('pay_list', D('Setting')->getPayList());
         //获取配送方式
         $this->assign('transport_list', D('Setting')->getTransportList());
         //取出购物车里面的内容
         $this->assign('car_list', D('ShoppingCar')->getCar());
         $this->display();
     }
 }
コード例 #14
0
 /**
  * [searchArticle 搜索文章]
  * @Author   罗江涛
  * @DateTime 2016-03-07T17:03:47+0800
  */
 public function searchArticle()
 {
     // 接收关键字
     $keyword = I("keyword", 0);
     // 是否清除搜索历史
     $cleanSearchHistory = I("cleanSearchHistory", 0);
     // 清除搜索历史
     if ($cleanSearchHistory) {
         cookie("searchHistory", null);
     }
     // 获取搜索历史
     $searchHistory = cookie("searchHistory");
     if ($keyword) {
         // 如果有关键字则保存到搜索历史
         if (!in_array($keyword, $searchHistory) && $keyword != "{{ todo.logo }}") {
             $searchHistory[] = $keyword;
             //p($searchHistory);die;
             cookie("searchHistory", $searchHistory);
         }
     } else {
         // 没有关键字倒序搜索历史,并分配
         $searchHistory = array_reverse($searchHistory);
         $this->assign("searchHistory", $searchHistory);
     }
     $this->display();
 }
コード例 #15
0
ファイル: GlobalController.class.php プロジェクト: noikiy/ypx
 protected function _initialize()
 {
     $this->_name = CONTROLLER_NAME;
     if (isLogin()) {
         define('AID', isLogin());
         $this->uid = decrypt(cookie('admin_id'));
         $this->admin_name = decrypt(cookie('admin_name'));
         $this->assign('admin_name', $this->admin_name);
     } else {
         $this->redirect('Public/login');
         exit;
     }
     import('ORG.Util.Auth');
     //加载类库
     $auth = new Auth();
     if (in_array(isLogin(), C("ADMINISTRATOR"))) {
         return true;
     } else {
         if ($auth->check(CONTROLLER_NAME . '-*', isLogin())) {
             true;
         } elseif (!$auth->check(CONTROLLER_NAME . '-' . ACTION_NAME, isLogin())) {
             echo CONTROLLER_NAME . '-' . ACTION_NAME;
             die;
             $this->error('你没有权限');
         }
     }
 }
コード例 #16
0
ファイル: PublishAction.class.php プロジェクト: easley999/tzj
 public function insert()
 {
     $model = D('Article');
     unset($_POST[$model->getPk()]);
     if (false === $model->create()) {
         $this->error($model->getError());
     }
     //保存当前数据对象
     $User = M('Member_user');
     $id = cookie('userid');
     $User = $User->find($id);
     $model->fbsj = date("Y-m-d");
     $model->username = cookie('username');
     $model->name = $User['name'];
     if (time() - $_SESSION[C('USER_AUTH_KEY_time')] < 20) {
         $this->error(L('对不起!你发信息太快了,请等待20秒钟后再发!'));
     }
     if ($result = $model->add()) {
         $_SESSION[C('USER_AUTH_KEY_time')] = time();
         $model->id = $result;
         $this->redirect('/index/article/index/articleid/' . $result . '');
     } else {
         $this->error($model->getError());
     }
 }
コード例 #17
0
 public function weixin()
 {
     $code = I('get.code');
     //获取code
     $get_access_token_url = 'https://api.weixin.qq.com/sns/oauth2/access_token';
     $get_access_token_json = http($get_access_token_url, array('appid' => 'wx893a9906fda1ed2c', 'secret' => '0c3ff723b18f7767a5e34ecb876dc947', 'code' => $code, 'grant_type' => 'authorization_code'), get);
     $access_token = json_decode($get_access_token_json, true)['access_token'];
     //获取access_token
     $openid = json_decode($get_access_token_json, true)['openid'];
     $get_userinfo_url = 'https://api.weixin.qq.com/sns/userinfo';
     $userinfo = http($get_userinfo_url, array('access_token' => $access_token, 'openid' => $openid), get);
     $userinfo = json_decode($userinfo, true);
     //获取用户信息
     if ($userinfo['openid']) {
         $check = M('Member')->where(array('openid' => $userinfo['openid']))->select();
         if (!$check) {
             $res = M('Member')->add(array('openid' => $userinfo['openid'], 'headimgurl' => $userinfo['headimgurl'], 'nickname' => $userinfo['nickname'], 'user' => $userinfo['openid'], 'registtime' => time(), 'last_login_time' => time()));
         } else {
             $res = M('Member')->where(array('openid' => $userinfo['openid']))->save(array('last_login_time' => time()));
         }
         if ($res) {
             $data = array('user' => $userinfo['openid'], 'nickname' => $userinfo['nickname'], 'status' => 1, 'headimgurl' => $userinfo['headimgurl']);
             cookie('login', json_encode($data), 604800);
         }
     }
     $this->redirect('Admin/index');
 }
コード例 #18
0
 /**
  * 修改截取后的头像
  */
 public function ModifyAvator()
 {
     $ShearPhoto["config"] = array("proportional" => 0);
     import('Vendor.ShearPhoto.ShearPhoto');
     $Shear = new \ShearPhoto(ACPopedom::mixPass(ACPopedom::getID()));
     $tmp_name = $Shear->run(json_decode(trim(stripslashes($_POST["JSdate"])), true), $ShearPhoto["config"]);
     //传入参数运行
     if (!$tmp_name) {
         $this->ajaxReturn(array('erro' => '头像保存失败'));
     }
     $filename = $Shear->filename . $Shear->imagesuffix;
     //又拍云上传
     import('Vendor.Upyun.UpYunApi');
     $upYunApi = new \UpYunApi(UPYUN_BUCKET, UPYUN_USERNAME, UPYUN_PASSWORD);
     $upYunApi->debug = false;
     $upYunApi->setApiDomain(UPYUN_HOST);
     $fh = fopen($tmp_name, 'rb');
     $rsp = $upYunApi->writeFile('/Attachment/face/' . $filename, $fh, true);
     if (file_exists(ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . $Shear->filename)) {
         unlink(ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . $filename);
     }
     fclose($fh);
     if ($rsp) {
         $result = M('Users')->where('userid = ' . ACPopedom::getID())->save(array('avator' => UPYUN_BASIC_URL . '/Attachment/face/' . $filename));
         if ($result !== false) {
             $userinfo = ACPopedom::getUserInfo();
             cookie("__info__", authcode(serialize(array('nickname' => $userinfo['nickname'], 'userid' => $userinfo['userid'], 'avator' => UPYUN_BASIC_URL . '/Attachment/face/' . $filename)), "ENCODE", SESSION_AUTH, C('COOKIE_EXPIRE')));
             $this->ajaxReturn(array('success' => '截图成功!如不能立即显示,请多刷新两次', 'url' => U('Web/UserCenter/index')));
         } else {
             $this->ajaxReturn(array('erro' => '头像更新失败'));
         }
     } else {
         $this->ajaxReturn(array('erro' => '头像更新失败'));
     }
 }
コード例 #19
0
function getCurrentUser()
{
    $_cookie_user = cookie('LOGGED_USER');
    $_session_user_id = intval($_SESSION['mid']);
    // 验证本地系统登录
    if ($_session_user_id) {
        return $_session_user_id;
    } elseif ($_cookie_user) {
        $cookieId = explode('.', jiemi($_cookie_user));
        if ($cookieId[0] !== 'thinksns') {
            return false;
        }
        $db_prefix = getDbPrefix();
        $userInfo = doQuery("SELECT * FROM {$db_prefix}user WHERE `uid` = '{$cookieId[1]}'");
        $user = doQuery("SELECT * FROM {$db_prefix}user WHERE `email` = '{$userInfo[0]['email']}'");
        if ($user) {
            $_SESSION['mid'] = $user[0]['uid'];
            return $_SESSION['mid'];
        } else {
            return false;
        }
    } else {
        return false;
    }
}
コード例 #20
0
 public function index()
 {
     cookie(null);
     $contiue = trim($_GET['continue']);
     $contiue = $contiue ? $contiue : '/?m=member&c=login';
     $this->redirect($contiue);
 }
コード例 #21
0
 /**
 +----------------------------------------------------------
 * 模板检查,如果不存在使用默认
 +----------------------------------------------------------
 * @access private
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 private function checkTemplate()
 {
     /* 获取模板主题名称 */
     $templateSet = C('DEFAULT_THEME');
     if (C('TMPL_DETECT_THEME')) {
         // 自动侦测模板主题
         $t = C('VAR_TEMPLATE');
         if (isset($_GET[$t])) {
             $templateSet = $_GET[$t];
         } elseif (cookie('think_template')) {
             $templateSet = cookie('think_template');
         }
         // 主题不存在时仍改回使用默认主题
         if (!is_dir(TMPL_PATH . $templateSet)) {
             $templateSet = C('DEFAULT_THEME');
         }
         cookie('think_template', $templateSet);
     }
     /* 模板相关目录常量 */
     define('THEME_NAME', $templateSet);
     // 当前模板主题名称
     $group = defined('GROUP_NAME') ? GROUP_NAME . '/' : '';
     define('THEME_PATH', TMPL_PATH . $group . (THEME_NAME ? THEME_NAME . '/' : ''));
     define('APP_TMPL_PATH', __ROOT__ . '/' . APP_NAME . (APP_NAME ? '/' : '') . 'Tpl/' . $group . (THEME_NAME ? THEME_NAME . '/' : ''));
     C('TEMPLATE_NAME', THEME_PATH . MODULE_NAME . (defined('GROUP_NAME') ? C('TMPL_FILE_DEPR') : '/') . ACTION_NAME . C('TMPL_TEMPLATE_SUFFIX'));
     C('CACHE_PATH', CACHE_PATH . $group);
     return;
 }
コード例 #22
0
 public function edit($id)
 {
     if (IS_POST) {
         if ($this->model->create() !== false) {
             //收集请求参数
             //                dump($this->model->create());
             //                exit;
             if ($this->model->save($this->usePostParams ? I('post.') : '') !== false) {
                 //修改
                 $this->success('修改成功!!!', cookie('__forward__'));
                 return;
             }
         }
         $this->error('操作失败!!!' . show_model_error($this->model));
     } else {
         $row = $this->model->find($id);
         //查询出这条数据
         $this->assign($row);
         //向叶面分配数据
         $this->assign('meta_title', '编辑' . $this->meta_title);
         $this->_edit_view_before();
         $this->display('edit');
         //加载叶面
     }
 }
コード例 #23
0
 function createCode($len = 4)
 {
     $width = 100;
     $height = 50;
     $size = 22;
     //字体大小
     $font = ROOT_PATH . '/static/font/arial.ttf';
     //字体
     $img = imagecreatetruecolor($width, $height);
     //创建画布
     $bgimg = imagecreatefromjpeg(ROOT_PATH . '/static/background/' . rand(1, 5) . '.jpg');
     //生成背景图片
     $bg_x = rand(0, 100);
     //随机招贴画布起始X轴坐标
     $bg_y = rand(0, 50);
     //随机招贴画布起始Y轴坐标
     imagecopy($img, $bgimg, 0, 0, $bg_x, $bg_y, $bg_x + $width, $bg_y + $height);
     //把背景图片$bging粘贴的画布上
     $str = $this->creaStr($len);
     //字符串
     for ($i = 0, $j = 5; $i < 4; $i++) {
         $array = array(-1, 1);
         $p = array_rand($array);
         $an = $array[$p] * mt_rand(1, 10);
         //扭曲角度
         imagettftext($img, $size, $an, $j + 5, 34, imagecolorallocate($img, rand(0, 100), rand(0, 100), rand(0, 100)), $font, $str[$i]);
         //生成验证字符窜
         $j += 20;
     }
     cookie('captchacode', strtolower($str));
     header('Content-type:image/png');
     imagepng($img);
     imagedestroy($img);
 }
コード例 #24
0
 /**
  * 该类创建对象时,会执行的方法
  */
 public function _initialize()
 {
     if (!isLogin()) {
         cookie('__LOGIN_RETURN_URL__', $_SERVER['REQUEST_URI']);
         $this->error('请登录!', U('Member/login'));
     }
 }
コード例 #25
0
 /**
  * 购物车列表 v3-b12
  */
 public function cart_infoOp()
 {
     $model_cart = Model('cart');
     $condition = array('buyer_id' => $this->member_info['member_id']);
     $cart_info = $model_cart->listCart('db', $condition);
     $sum = 0;
     if (cookie('cart_goods_num') != null) {
         $num = intval(cookie('cart_goods_num'));
     } else {
         //已登录状态,存入数据库,未登录时,优先存入缓存,否则存入COOKIE
         if ($_SESSION['member_id']) {
             $save_type = 'db';
         } else {
             $save_type = 'cookie';
         }
         $num = Model('cart')->getCartNum($save_type, array('buyer_id' => $_SESSION['member_id']));
         //查询购物车商品种类
     }
     foreach ($cart_info as $key => $value) {
         $cart_info[$key]['goods_image_url'] = cthumb($value['goods_image'], $value['store_id']);
         $cart_info[$key]['goods_sum'] = ncPriceFormat($value['goods_price'] * $value['goods_num']);
         $sum += $cart_info[$key]['goods_sum'];
     }
     output_data(array('num' => $num, 'sum' => ncPriceFormat($sum)));
 }
コード例 #26
0
 public function edit($id)
 {
     $model = D('CarClass');
     if (IS_POST) {
         if ($model->create()) {
             $result = $model->save();
             if ($result !== false) {
                 $this->success('跟新成功', cookie('_currentUrl_'));
             } else {
                 $this->error('跟新失败' . $model->getDbError(), cookie('_currentUrl_'));
             }
         } else {
             $this->error('跟新失败' . $model->getError(), U('index'));
         }
     } else {
         $id = I('get.id', 0, 'intval');
         $data = $model->find($id);
         $carbrand = M('CarBrand')->where('is_lock = 0')->order('letter asc, sort desc')->select();
         $subbrand = M('CarSubBrand')->where('bid = ' . $data['brand_id'])->select();
         $carseries = M('CarSeries')->where($map)->select();
         $caryear = M('CarYear')->where($map)->select();
         $carlevel = M('CarLevel')->where($map)->select();
         $carstructure = M('CarStructure')->where($map)->select();
         $caresid = M('CarEsid')->where($map)->select();
         $this->assign(array('carbrand' => $carbrand, 'subbrand' => $subbrand, 'carseries' => $carseries, 'caryear' => $caryear, 'carlevel' => $carlevel, 'carstructure' => $carstructure, 'caresid' => $caresid, 'data' => $data));
         $this->display();
     }
 }
コード例 #27
0
ファイル: LoginlogController.php プロジェクト: hubs/yuncms
 public function __construct()
 {
     parent::__construct();
     $this->db = Loader::model('admin_login_log_model');
     $this->admin_username = cookie('admin_username');
     // 管理员COOKIE
 }
コード例 #28
0
ファイル: userFunc.php プロジェクト: ReadYun/vixik
function userCreate($user_info)
{
    // 用户基本信息数据整理
    $user_code = M(TB_BAS_USER_INFO)->max('user_code') + 1;
    // 新建用户编码
    $user_info['user_code'] = $user_code;
    $user_info['user_nick'] = $user_info['user_name'];
    $user_info['create_time'] = date('Y-m-d H:i:s');
    $user_info['user_type'] = 6;
    // 默认普通用户类型
    $user['user_code'] = $user_code;
    // 用户账户信息数据整理
    $user_accout = array('user_code' => $user_code, 'user_score' => 0, 'user_level' => 0, 'user_coins' => 0, 'login_time' => $user_info['create_time'], 'publish_times' => 0, 'answer_times' => 0);
    // 新用户相关数据写入对应数据表
    if (insertTable(TB_BAS_USER_INFO, $user_info) && insertTable(TB_BAS_USER_ACCOUT, $user_accout) && insertTable(TB_BAS_USER_EXTEND_INFO, $user) && insertTable(TB_BAS_USER_INTEREST, $user)) {
        // 创建用户成功直接生成新用户cookie
        cookie('user_code', $user_info['user_code'], 360000);
        cookie('user_name', $user_info['user_name'], 360000);
        cookie('user_nick', $user_info['user_nick'], 360000);
        cookie('user_pwd', $user_info['user_pwd'], 360000);
        // 返回数据
        return $user_code;
    } else {
        return false;
    }
}
コード例 #29
0
ファイル: commonAction.php プロジェクト: Jeremysoft/mallmold
 private function init()
 {
     require_once APP_PATH . 'model/functions.php';
     $this->setting =& $this->model('common')->setting();
     //set lang
     $current_lang = $this->model('visitor')->visitor_lang();
     cookie('lang', $current_lang);
     $this->config['LAN_NAME'] = $current_lang;
     $this->setting = $this->model('dictionary')->getdict($this->setting);
     //set cur
     $last_cur = cookie('cur');
     $current_cur = $this->model('visitor')->visitor_currency();
     if ($last_cur != $current_cur) {
         cookie('cur', $current_cur);
         $this->model('cart')->change_cart_cur();
     }
     //set template
     $template = $this->model('visitor')->visitor_tpl();
     if ($template) {
         $this->set_template($template);
     }
     $this->view['current_lang'] = $current_lang;
     $this->view['current_cur'] = $current_cur;
     $this->view['current_symbol'] =& $this->model('common')->current_symbol();
 }
コード例 #30
0
 /**
  * 自动登陆处理
  */
 public function _before_index()
 {
     $user_session = cookie('user_session');
     if ($user_session) {
         //auto login
         $map['user_session'] = $user_session;
         $UserEvent = new UserEvent();
         $loginRes = $UserEvent->auth($map);
         $loginResArray = json_decode($loginRes, true);
         if ($loginResArray['status'] == 1) {
             //登陆成功
             $authInfo = D('User', 'Logic')->where($map)->find();
             $log['log_user_id'] = $authInfo['user_id'];
             $log['log_user_name'] = $authInfo['user_login'];
             $log['log_password'] = $authInfo['user_pass'];
             $log['log_ip'] = get_client_ip();
             $log['log_status'] = 2;
             D('login_log')->data($log)->add();
             if (cookie("last_visit_page")) {
                 redirect(base64_decode(cookie("last_visit_page")));
             } else {
                 $this->redirect('Admin/Index/index');
             }
         }
     }
 }