详情页

ecshop商城用户名和邮箱都能登陆方法

时间:2024年02月05日

编辑:佚名

修改方法:打开 /includes/modules/integrates/integrate.php 查找代码
复制代码
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 ($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;
         }
     }
复制代码
相关文章
猜你需要