ThinkPHP 3.1.3 用户名或手机登录 多形式账号登录

浏览:1314 发布日期:2017/12/02 分类:功能实现 关键字: 登录 多账号 手机 昵称 用户名
ThinkPHP 3.1.3 用户名或手机登录 多形式账号登录

代码发布者QQ:467477957
PHP登录:$res=mysql_query("SELECT * FROM think_member WHERE username = '$_POST[m]' and password = '$_POST[password]'  or tel = '$_POST[m]' and password = '$_POST[password]' limit 1");

 if ($res2 = mysql_fetch_array($res)) {
        import('ORG.Util.Session');
                Session::set('m',$_POST['m']);
$this->success('登录成功!','__ROOT__/');
}
else{
$this->error('用户名或密码错误!'); 
}
ThinkPHP 登录:$res = $Member->where("tel='$_POST[m]' and password='$_POST[password]' or username = '$_POST[m]' and password = '$_POST[password]'")->find();//此处$res代表的是两个条件的值
     if ($res){
  
import('ORG.Util.Session');
            Session::set('m',$_POST['m']);
    
$this->success('登录成功!','__ROOT__/');
}
else{
$this->error('用户名或密码错误!'); 
}
评论( 相关
后面还有条评论,点击查看>>