您好,登錄后才能下訂單哦!
用于后臺(tái)登錄驗(yàn)證
post_controller_constructor
<?php class Auth { private $CI; private $loginUri = 'welcome/login'; private $loginAuth = FALSE; private $sessId = null; public function __construct(){ $this->CI = &get_instance(); $this->CI->load->helper('url'); $this->initSession(); $this->setLoginAuth(); } public function initSession(){ if(session_status()===1){ session_name(SESS_NAME); if($this->sessId!==null){ session_id($this->sessId); } $lifeTime = 24 * 3600; session_set_cookie_params($lifeTime); session_start(); } } public function setLoginAuth(){ if(!empty($_SESSION['admin_user_id'])){ $this->loginAuth = TRUE; } } public function chkLoginAuth(){ if(!$this->loginAuth && !in_array(uri_string(),array('login', 'login/ajaxsub'))){ redirect($this->loginUri); } return TRUE; } }
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。