function _initialize()
 {
     $this->pre = C('DB_PREFIX');
     $query_string = explode("/", $_SERVER['REQUEST_URI']);
     $code = strtolower(MODULE_NAME);
     !isset($this->justlogin) ? $this->justlogin = false : ($this->justlogin = $this->justlogin);
     if (session('admin')) {
         //dump(session('adminname'));exit;
         $this->admin_id = session("admin");
         $this->assign('adminname', session('adminname'));
     } elseif (strtolower(ACTION_NAME) != 'verify' && strtolower(ACTION_NAME) != 'login' && strtolower(ACTION_NAME) != 'logincheck') {
         // 			redirect(__ROOT__."/index.php/admin/index/logincheck?code=".$query_string[2]);
         redirect(__ROOT__ . "/index.php/admin/index/logincheck?code=" . $code);
         exit;
     }
     if (!get_user_acl(session('admin')) && !$this->justlogin) {
         $this->error('对不起,权限不足');
         exit;
     }
     if (method_exists($this, '_MyInit')) {
         $this->_MyInit();
     }
     $datag = get_global_setting();
     $this->glo = $datag;
     //供PHP里面使用
     $this->assign("glo", $datag);
     $bconf = get_bconf_setting();
     $this->gloconf = $bconf;
     //供PHP里面使用
     $this->assign("gloconf", $bconf);
 }
 function _initialize()
 {
     $datag = get_global_setting();
     $this->glo = $datag;
     //供PHP里面使用
     $this->assign("glo", $datag);
     $bconf = get_bconf_setting();
     $this->gloconf = $bconf;
     //供PHP里面使用
     $this->assign("gloconf", $bconf);
     $hetong = M('hetong')->field('name,dizhi,tel')->find();
     $this->assign("web", $hetong);
     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();
     }
 }
Example #3
0
 protected function _initialize()
 {
     $loginconfig = FS("Webconfig/loginconfig");
     //判断快捷登录是否开启
     $this->assign("loginconfig", $loginconfig);
     $datag = get_global_setting();
     $this->glo = $datag;
     //供PHP里面使用
     $this->assign("glo", $datag);
     //公共参数
     $bconf = get_bconf_setting();
     $this->gloconf = $bconf;
     //供PHP里面使用
     $this->assign("gloconf", $bconf);
     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", 'regsuccess', 'emailverify', 'verify', 'corpregister2'))) {
                 redirect(__APP__ . "/member/");
             }
             $res = M("members")->field("usrid,iscorp")->where("id={$this->uid}")->find();
             if (empty($res['usrid']) && $res['iscorp'] == 0) {
                 if (!in_array(strtolower(ACTION_NAME), array("actlogout", "corpregister2", "bind", "corpbind"))) {
                     redirect(__APP__ . "/member/common/register2/");
                 }
             } else {
                 if (empty($res['usrid']) && $res['iscorp'] == 1) {
                     if (!in_array(strtolower(ACTION_NAME), array("actlogout", "corpregister2", "bind", "corpbind"))) {
                         redirect(__APP__ . "/member/common/corpregister2/");
                     }
                 }
             }
         } 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", 'regsuccess', 'emailverify', 'verify', 'corpregister2'))) {
                         redirect(__APP__ . "/member/");
                     }
                     $res = M("members")->field("usrid,iscorp")->where("id={$this->uid}")->find();
                     if (empty($res['usrid']) && $res['iscorp'] == 0) {
                         if (!in_array(strtolower(ACTION_NAME), array("actlogout", "corpregister2", "bind", "corpbind"))) {
                             redirect(__APP__ . "/member/common/register2/");
                         }
                     } else {
                         if (empty($res['usrid']) && $res['iscorp'] == 1) {
                             if (!in_array(strtolower(ACTION_NAME), array("actlogout", "corpregister2", "bind", "corpbind"))) {
                                 redirect(__APP__ . "/member/common/corpregister2/");
                             }
                         }
                     }
                 } 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);
         /*$res = M("members")->field("usrid,iscorp")->where("id={$this->uid}")->find();
         		if(empty($res['usrid']) && $res['iscorp']==0)
         		{
         			if(!in_array(strtolower(ACTION_NAME),array("actlogout","corpregister2","bind","corpbind")))
         			{
         				redirect(__APP__."/member/common/register2/");
         			}
         		}
         		else if(empty($res['usrid']) && $res['iscorp']==1)
         		{
         			if(!in_array(strtolower(ACTION_NAME),array("actlogout","corpregister2","bind","corpbind")))
         			{
         				redirect(__APP__."/member/common/corpregister2/");
         			}
         		}*/
     } 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);
                 $res = M("members")->field("usrid,iscorp")->where("id={$this->uid}")->find();
                 if (empty($res['usrid']) && $res['iscorp'] == 0) {
                     if (!in_array(strtolower(ACTION_NAME), array("actlogout", "corpregister2", "bind", "corpbind"))) {
                         redirect(__APP__ . "/member/common/register2/");
                     }
                 } else {
                     if (empty($res['usrid']) && $res['iscorp'] == 1) {
                         if (!in_array(strtolower(ACTION_NAME), array("actlogout", "corpregister2", "bind", "corpbind"))) {
                             redirect(__APP__ . "/member/common/corpregister2/");
                         }
                     }
                 }
             } else {
                 cookie("Ukey", NULL);
                 cookie("Ukey2", NULL);
             }
         } else {
             redirect(__APP__ . "/member/common/login/");
             exit;
         }
     }
     /***检测用户类型**/
     $type = member_type($this->uid);
     if ($type['status'] != 3) {
         $this->is_show_auto = 0;
     } else {
         $this->is_show_auto = 1;
     }
     /*****/
     $hasbind = hasbind($this->uid);
     session("hasbind", $hasbind);
     $this->assign("hasbind", $hasbind);
     if (method_exists($this, '_MyInit')) {
         $this->_MyInit();
     }
 }
 protected function _initialize()
 {
     $loginconfig = FS("Webconfig/loginconfig");
     //判断快捷登录是否开启
     $this->assign("loginconfig", $loginconfig);
     $datag = get_global_setting();
     $this->glo = $datag;
     //供PHP里面使用
     $this->assign("glo", $datag);
     //公共参数
     $hetong = M('hetong')->field('name,dizhi,tel')->find();
     $this->assign("web", $hetong);
     $bconf = get_bconf_setting();
     $this->gloconf = $bconf;
     //供PHP里面使用
     $this->assign("gloconf", $bconf);
     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", '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", '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/common/login/");
             exit;
         }
     }
     if (method_exists($this, '_MyInit')) {
         $this->_MyInit();
     }
 }
 public function _initialize()
 {
     if (!ListMobile()) {
         if ($_SERVER["HTTPS"] != "on" && 'login' == ACTION_NAME) {
             $xredir = "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
             header("Location: " . $xredir);
         } else {
             if ('on' == $_SERVER['HTTPS'] && 'index' == ACTION_NAME) {
                 $xredir = "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
                 redirect($xredir);
             }
         }
     }
     parent::_initialize();
     $loginconfig = FS("Webconfig/loginconfig");
     //判断快捷登录是否开启
     $this->assign("loginconfig", $loginconfig);
     $datag = get_global_setting();
     $this->glo = $datag;
     //供PHP里面使用
     $this->assign("glo", $datag);
     //公共参数
     $bconf = get_bconf_setting();
     $this->gloconf = $bconf;
     //供PHP里面使用
     $this->assign("gloconf", $bconf);
     if (isset($_POST['PHPSESSID'])) {
         session_id($_POST['PHPSESSID']);
     } else {
         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('agreement', 'ajaxredbag', 'redbag', 'setpassword', 'validatephonev2', 'getpassword2', 'getpassword3', "actlogout", 'sendpswphone', 'regsuccess', 'submitrealname', 'regrealname', 'verphonev', 'emailverify', 'register2', 'register3', 'regtemp2', 'sendphone', 'sendphone_reg', 'validatephonev', '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", '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/common/login/");
                 exit;
             }
         }
         //否则就在这里正常验证
     }
     if (method_exists($this, '_MyInit')) {
         $this->_MyInit();
     }
 }