Created
March 6, 2014 13:20
-
-
Save no13bus/9389531 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommonAction extends Action | |
{ | |
public function _initialize() | |
{ | |
if(isset($_COOKIE['auto']) && !isset($_SESSION['uid'])){ | |
$auto=explode('|',$_COOKIE['auto']); | |
$where=array('uid'=>$auto[0],'username'=>$auto[1]); | |
$user=M('user')->where($where)->find(); | |
if ($user) { | |
session('uid',$user['id']); | |
session('username',$user['username']); | |
session('email',$user['email']); | |
$this->user_info = $user; | |
$this->loginbool = 1; | |
} | |
}else if(isset($_SESSION['uid'])){ | |
$user=M('user')->where(array('uid' => $_SESSION['uid']))->find(); | |
$this->user_info = $user; | |
$this->loginbool = 1; | |
}else{ | |
$this->loginbool = 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment