1.前台ajax数据提交
2.后台校验:
* */
public function check_login(){
$password=I('param.password');
$username=I('param.username');
$data["name"]=$username;
$user=M('systemuser');
$list=$user->where($data)->find();
$return=0;
if($list!=""){
if($list['password']==md5($password) && $list['status'] == 1){
//登录时间和登录IP
$public = new PublicController();
$lastlogonip=$public->ip_address();
$time=$time=date("Y-m-d H:i:s", time());
$where=array('id'=>$list['id']);
$user->where($where)->save(array('lastlogonip'=>$lastlogonip,'lastlogontime'=>$time));
$this->login($list);
$return=1;//登录成功
}
}else{
$return=2;//登录失败
}
$this->ajaxReturn($return);
}
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持考高分网!



