This file contains hidden or 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
| <?php | |
| /** | |
| * | |
| */ | |
| class TopicViewModel extends ViewModel | |
| { | |
| public $viewFields = array( | |
| 'topic' => array('id','title','content','last_replied_by','last_touched','created'), | |
| 'user' => array('username','nickname','avatar','uid','reputation', '_on' => 'topic.author_id=user.uid'), |
This file contains hidden or 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
| public function login() | |
| { | |
| if(!IS_POST) $this->redirect('index',array('errormsg' => '非法请求')); | |
| $email = I('email'); | |
| $last_login = date(time(),"Y-m-d,H:i:s"); | |
| $password = I('password','','md5'); | |
| /////find只会找到一条记录 这个是和select不同的地方 这找到的是一个集合 | |
| $user = M('user')->where(array('email' => $email))->find(); | |
| if (!$user || $user['password']!= $password) { |
This file contains hidden or 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']); |
NewerOlder