欢迎来到258分享网,纯净的网络源码分享基地!

258资源分享网

全部作品
全部作品
网站源码
微信源码
素材特效
源码插件
视频教程
建站学院
热门搜索: 织梦  农业种植  农业  安全设置  官方
258资源分享 > 建站学院 > ecshop教程 > ecshop让用户名和email都可以登陆!

推荐下载

HTML5响应式自适应网咯设计

2020-05-12   浏览:740

高端HTML5响应式企业通用网

2020-05-06   浏览:521

html5响应式外贸网站英文版

2020-05-08   浏览:510

HTML5自适应律师工作室类网

2020-04-04   浏览:504

HTML5影视传媒文化公司类网

2020-05-12   浏览:500

ecshop让用户名和email都可以登陆!

发布时间:2021-06-03  

email登陆,好处很明显.
1:可以促使用户填写真实的email.
2:不易忘记.

下面的改动,可以使ecshopemail,用户名都可以完成登陆.
---------------------------分割线-----------------------------
改动版本: ecshop 2.7.0
改动程序: /includes/modules/integrates/integrate.php
改动代码:145--162行的用户登陆函数.如下

function login($username, $password)

{

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;

}

}

改为:

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;
                //echo $sql;exit;
        }
        if ($this->check_user($username, $password) > 0)

{

if ($this->need_sync)

{

$this->sync($username,$password);

}

$this->set_session($username);

$this->set_cookie($username);