如何实现ecshop 让用户名和email都可以登陆

下面ECSHOP开发中心分享一个ecshop用户名和Email同时登陆的

改动程序: /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);

return true;

}

else

{

return false;

}

}

,理想的路总是为有信心的人预备着

如何实现ecshop 让用户名和email都可以登陆

相关文章:

你感兴趣的文章:

标签云: