Пример #1
0
 function _initialize()
 {
     parent::_initialize();
     $site_options = get_site_options();
     $this->assign($site_options);
     $ucenter_syn = C("UCENTER_ENABLED");
     if ($ucenter_syn) {
         if (!isset($_SESSION["user"])) {
             if (!empty($_COOKIE['thinkcmf_auth']) && $_COOKIE['thinkcmf_auth'] != "logout") {
                 $thinkcmf_auth = sp_authcode($_COOKIE['thinkcmf_auth'], "DECODE");
                 $thinkcmf_auth = explode("\t", $thinkcmf_auth);
                 $auth_username = $thinkcmf_auth[1];
                 $users_model = M('Users');
                 $where['user_login'] = $auth_username;
                 $user = $users_model->where($where)->find();
                 if (!empty($user)) {
                     $is_login = true;
                     $_SESSION["user"] = $user;
                 }
             }
         } else {
         }
     }
     if (sp_is_user_login()) {
         $this->assign("user", sp_get_current_user());
     }
 }
 function _initialize()
 {
     parent::_initialize();
     $site_options = get_site_options();
     $this->assign($site_options);
     $ucenter_syn = C("UCENTER_ENABLED");
     if ($ucenter_syn) {
         if (!isset($_SESSION["user"])) {
             if (!empty($_COOKIE['thinkcmf_auth']) && $_COOKIE['thinkcmf_auth'] != "logout") {
                 $thinkcmf_auth = sp_authcode($_COOKIE['thinkcmf_auth'], "DECODE");
                 $thinkcmf_auth = explode("\t", $thinkcmf_auth);
                 $auth_username = $thinkcmf_auth[1];
                 $users_model = M('Member');
                 $where['user_login'] = $auth_username;
                 $user = $users_model->where($where)->find();
                 if (!empty($user)) {
                     $is_login = true;
                     $_SESSION["user"] = $user;
                 }
             }
         } else {
         }
     }
     if (sp_is_user_login()) {
         $this->assign("user", sp_get_current_user());
     } else {
         if (isset($_COOKIE['user_login'])) {
             $users_model = M('Member');
             $where['user_login'] = $_COOKIE['user_login'];
             $user = $users_model->where($where)->find();
             //echo $_COOKIE['user_auth'];echo '<br>';echo md5($result['user_pass'].'iloveyouhmvpoint');die;
             if (md5($user['user_pass'] . 'iloveyouhmvpoint') == $_COOKIE['user_auth']) {
                 $_SESSION['user'] = $user;
             }
         }
     }
     // 热搜
     $top_hot_search = M('Ad')->where('ad_content="top_hot_search"')->limit(7)->select();
     $this->assign('top_hot_search', $top_hot_search);
     $cart = A('Order/Cart')->cart();
     $this->assign('cartNum', count($cart['cart']));
 }
 function _initialize()
 {
     parent::_initialize();
     if (isset($_SESSION['ADMIN_ID'])) {
         $users_obj = M("Users");
         $id = $_SESSION['ADMIN_ID'];
         $user = $users_obj->where("id={$id}")->find();
         if (!$this->check_access($id)) {
             $this->error("您没有访问权限!");
             exit;
         }
         $this->assign("admin", $user);
     } else {
         //$this->error("您还没有登录!",U("admin/public/login"));
         if (IS_AJAX) {
             $this->error("您还没有登录!", U("admin/public/login"));
         } else {
             header("Location:" . U("admin/public/login"));
             exit;
         }
     }
 }
Пример #4
0
 function _initialize()
 {
     parent::_initialize();
     $this->guestbook_model = D("Common/Guestbook");
 }