实现用户名、注册email、手机号都可登录
2016-07-07 15:01 来源:www.chinab4c.com 作者:ecshop专家
在注册用户时,只要你填写正确的邮箱、手机号,在下次登录时,随便输入其中一种就可登录商城 在includes/lib_common.php文件中添加一个验证手机号的函数 /** * 验证输入手机号是否合法 * * @accesspublic * @paramstring$phone需要验证的手机号 * * @return bool */ function is_telephone($phone){ $chars = "/^13[0-9]{1}[0-9]{8}$|15[0-9]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$/"; if (preg_match($chars, $phone)){ return true; } else{ echo "<font color=#CC0000>"."输入的手机格式不正确</font>"; } } 手机号:130 --139 xxxxxxxx 150--159 xxxxxxxx 180--189 xxxxxxxx 在includes/modules/integrates/integrate.php 文件中 修改 login 函数,改为: function login($username, $password) { if(is_email($username)) { $sql = "select ".$this->field_name." from ".$this->table($this->user_table)." where ".$this->field_email."='".$username."'"; $username = $this->db->getOne($sql); if(!$username) return false; } if(is_telephone($username)){ $sql = "select ".$this->field_name." from ".$this->table($this->user_table)." where mobile_phone ='".$username."'"; $username = $this->db->getOne($sql); if(!$username) return false; } if ($this->check_user($username, $password) > 0) { if ($this->need_sync) { $this->sync($username,$password); } $this->set_session($username); $this->set_cookie($username); return true; } else { return false; } } |
回答:
支持!!!!! |
手机号无法登录..... |
LZ忽略了一个很重要的事情,就是注册的时候,还必须限定用户名,邮箱,手机号唯一. |
这个功能太有材了。。正想要呢 |
用户名跟邮箱都有唯一性验证的,手机没有唯一性验证,这样的话问题就很大了。 测试了用同一个**多个号,两个密码一样的号用手机登录的话,登录的是第一次注册的 两个密码不一样的号登录的时候就会显示密码不正确。 看来还是要解决一下,手机号唯一的验证问题。 |
楼主很强大啊,顶 |
最近更新
常用插件
- ecshop二次商品订购人信息
ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的...
- ecshop分类批量扩展插件
ecshop分类批量扩展插件,这个插件是ecshop插件里面比较核心的插件。我们...
- ecshop商品分类名称增加样
ecshop插件介绍:本插件可以方便在后台管理,为ecshop商品分类名称增加样...
- ecshop2.7.1打印发货单插件
ecshop2.7.1打印发货单插件介绍:ecshop2.7.1和以前的ecshop版本不一样,ecs...
- ecshop二次开发详细页面生
插件介绍: ECSHOP系统,在很多时候,很多商品没有人购买,不但购买的人...
ecshop热门问答
ecshop热门资料
ecshop去除
ecshop跟随
库存为0
ecmall系统参数
ecshop上架
ecshop十万火急
ecshop微录手表
ecshop送货上门
ecshop论坛
ecshop视频播放
ecmall公告挂件
ecshop标签自动切换
ecshop款式
ecshop透支
ecshop等等等
ecshop秒杀插件
ecshop欧洲
ecshop好手
dedecms文章统计
ecshop客流量
ecshop签名
ecshopgram
ecshop模板问题
ecshop电商
ecshop详细描述
ecshop属性库存
ecshop模板美化
ecshoparr
ecshop网站购物系统
ecshop版块