• ecshop登录


    邮箱登录

    a.找到function login(){} ,增加一个邮箱判断is_mail()  ,

    b.如果通过,增读取出username ,

    c.再通过默认的login功能

    1.需要修改文件include/modules/integrates/integrate.php

    原代码 第145行

    function login($username, $password, $remember = null)
        {
            
            if ($this->check_user($username, $password) > 0)
            {
                if ($this->need_sync)
                {
                    $this->sync($username,$password);
                }
                $this->set_session($username);
                $this->set_cookie($username, $remember);
    
                return true;
            }
            else
            {
                return false;
            }
        }

    修改代码

     function login($username, $password, $remember = null)
        {
         // 邮箱验证
    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, $remember); return true; } else { return false; } }

    2.include/lib_common.php 增加手机判断格式  第40行

    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{
            return false;    
        }
    }
  • 相关阅读:
    centos7 安装redis服务及phpredis扩展
    centos7 LANMP 安装
    php reids 单机命令
    浅谈正向代理和反向代理
    php-fpm日志告警"seem busy"
    PHP-redis中文文档
    Nginx配置文件nginx.conf中文详解
    生成带参数的微信二维码
    微信临时二维码时为32位非0整型
    [Linux]Service mysql start出错(mysql: unrecognized service)解决方法
  • 原文地址:https://www.cnblogs.com/wesky/p/5220763.html
Copyright © 2020-2023  润新知