轻源码

  • QingYuanMa.com
  • 全球最大的互联网技术和资源下载平台
搜索
一起源码网 门户 ECShop网店 查看主题

ECSHOP手机号码或邮箱用户名都可以登录方法

发布者: zenking | 发布时间: 2018-5-11 06:23| 查看数: 5602| 评论数: 1|帖子模式

有不少人都在找支持ECShop用户名、邮箱或手号码登录的插件,下面就讲一下如何实现用户名、邮箱或手机号码登录ECShop。
  找到user.php 的以下代码:
  1. if (empty($_POST['captcha']))
  2. {
  3. show_message($_LANG['invalid_captcha'], $_LANG['relogin_lnk'], 'user.php', 'error');
  4. }
复制代码
  后面增加:
  1. if(is_email($username))
  2. {
  3. $sql ="select user_name from ".$ecs->table('users')." where email='".$username."'";
  4. $username_e = $db->getOne($sql);
  5. if($username_e) $username=$username_e;
  6. }
  7. if(is_telephone($username))
  8. {
  9. $sql ="select user_name from ".$ecs->table('users')." where mobile_phone='".$username."'";
  10. $username_e = $db->getOne($sql);
  11. if($username_e) $username=$username_e;
  12. }
复制代码
  然后在user.php的最底部添加:
  1. function is_telephone($phone){
  2. $chars = "/^13[0-9]{1}[0-9]{8}$|15[0-9]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$/";
  3. if (preg_match($chars, $phone)){
  4. return true;
  5. }
  6. }
复制代码
  大功告成!

最新评论

渣男. 发表于 2022-6-14 19:54
软件源码交易平台

轻源码让程序更轻更快

QingYuanMa.com

工作时间 周一至周六 8:00-17:30

侵权处理

客服QQ点击咨询

关注抖音号

定期抽VIP

Copyright © 2016-2021 https://www.171739.xyz/ 滇ICP备13200218号

快速回复 返回顶部 返回列表