Exemplo n.º 1
0
 function _initialize()
 {
     //友情链接
     $parm['is_show'] = 1;
     $yqList = M('friend')->where($map)->order('link_order')->select();
     $this->assign("yqList", $yqList);
     judgeHttps($this->isAjax());
     $datag = get_global_setting();
     $this->glo = $datag;
     //供PHP里面使用
     $this->assign("glo", $datag);
     //分站
     $this->assign("subsite", getSubSite());
     $this->siteInfo = getLocalhost();
     $this->assign("siteInfo", $this->siteInfo);
     //分站
     if (session("u_user_name")) {
         $this->uid = session("u_id");
         $unread = M("inner_msg")->where("uid={$this->uid} AND status=0")->count('id');
         $this->assign('unread', $unread);
         $this->assign('UID', $this->uid);
     } else {
         $loginconfig = FS("Webconfig/loginconfig");
         $de_val = $this->_authcode(cookie('UKey'), 'DECODE', $loginconfig['cookie']['key']);
         if (substr(md5($loginconfig['cookie']['key'] . $de_val), 14, 10) == cookie('Ukey2')) {
             $vo = M('members')->field("id,user_name")->find($de_val);
             if (is_array($vo)) {
                 foreach ($vo as $key => $v) {
                     session("u_{$key}", $v);
                 }
                 $this->uid = session("u_id");
                 $this->assign('UID', $this->uid);
                 $unread = M("inner_msg")->where("uid={$this->uid} AND status=0")->count('id');
                 $this->assign('unread', $unread);
             } else {
                 cookie("Ukey", NULL);
                 cookie("Ukey2", NULL);
             }
         }
     }
     if (method_exists($this, '_MyInit')) {
         $this->_MyInit();
     }
 }
Exemplo n.º 2
0
 protected function _initialize()
 {
     $datag = get_global_setting();
     $this->glo = $datag;
     //供PHP里面使用
     $this->assign("glo", $datag);
     //公共参数
     //分站
     $this->assign("subsite", getSubSite());
     $this->siteInfo = getLocalhost();
     $this->assign("siteInfo", $this->siteInfo);
     //分站
     if ($this->notneedlogin === true) {
         if (session("u_id")) {
             $this->uid = session("u_id");
             $this->assign('UID', $this->uid);
             $unread = M("inner_msg")->where("uid={$this->uid} AND status=0")->count('id');
             $this->assign('unread', $unread);
             if (!in_array(strtolower(ACTION_NAME), array("actlogout", "mactlogout", 'regsuccess', 'emailverify', 'verify'))) {
                 redirect(__APP__ . "/member/");
             }
         } else {
             $loginconfig = FS("Webconfig/loginconfig");
             $de_val = $this->_authcode(cookie('UKey'), 'DECODE', $loginconfig['cookie']['key']);
             if (substr(md5($loginconfig['cookie']['key'] . $de_val), 14, 10) == cookie('Ukey2')) {
                 $vo = M('members')->field("id,user_name")->find($de_val);
                 if (is_array($vo)) {
                     foreach ($vo as $key => $v) {
                         session("u_{$key}", $v);
                     }
                     $this->uid = session("u_id");
                     $this->assign('UID', $this->uid);
                     $unread = M("inner_msg")->where("uid={$this->uid} AND status=0")->count('id');
                     $this->assign('unread', $unread);
                     if (!in_array(strtolower(ACTION_NAME), array("actlogout", "mactlogout", 'regsuccess', 'emailverify', 'verify'))) {
                         redirect(__APP__ . "/member/");
                     }
                 } else {
                     cookie("Ukey", NULL);
                     cookie("Ukey2", NULL);
                 }
             }
         }
     } elseif (session("u_user_name")) {
         $this->uid = session("u_id");
         $unread = M("inner_msg")->where("uid={$this->uid} AND status=0")->count('id');
         $this->assign('unread', $unread);
         $this->assign('UID', $this->uid);
     } else {
         $loginconfig = FS("Webconfig/loginconfig");
         $de_val = $this->_authcode(cookie('UKey'), 'DECODE', $loginconfig['cookie']['key']);
         if (substr(md5($loginconfig['cookie']['key'] . $de_val), 14, 10) == cookie('Ukey2')) {
             $vo = M('members')->field("id,user_name")->find($de_val);
             if (is_array($vo)) {
                 foreach ($vo as $key => $v) {
                     session("u_{$key}", $v);
                 }
                 $this->uid = session("u_id");
                 $this->assign('UID', $this->uid);
                 $unread = M("inner_msg")->where("uid={$this->uid} AND status=0")->count('id');
                 $this->assign('unread', $unread);
             } else {
                 cookie("Ukey", NULL);
                 cookie("Ukey2", NULL);
             }
         } else {
             redirect(__APP__ . "/member/Mobilecommon/login/");
             exit;
         }
     }
     $time = time() * 1000;
     $this->assign('time', $time);
     if (method_exists($this, '_MyInit')) {
         $this->_MyInit();
     }
 }