您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程

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

路留时2023-12-12 18:08:41ecshop商城教程已有人查阅

导读修改方法:/includes/modules/integrates/integrate.php文件约145- 162行的用户登入函数.如下

修改方法:/includes/modules/integrates/integrate.php文件约145- 162行的用户登入函数.如下
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;
}
}

本文标签:

很赞哦! ()

留言与评论 (共有 条评论)
验证码:

本栏推荐

相关标签