ECSHOP同时使用用户名、邮箱、手机号码登录

1.在includes/modules/integrates/ecshop.php中的
$this->field_email = 'email';
下方,添加
$this->field_phone = 'mobile_phone';
找到
function check_user($username, $password = null)

这个下面的

			$sql = "SELECT " . $this->field_id .
					" FROM " . $this->table($this->user_table).
					" WHERE " . $this->field_name . "='" . $post_username . "'";
替换为
			$sql = "SELECT " . $this->field_id .
					" FROM " . $this->table($this->user_table).
					" WHERE " . $this->field_name . "='" . $post_username . "' or " . $this->field_phone . "='" . $post_username . "' or " . $this->field_email . "='" . $post_username . "'";
再找到
			$sql = "SELECT user_id, password, salt,ec_salt " .
					" FROM " . $this->table($this->user_table).
					" WHERE user_name='$post_username'";
替换为
			$sql = "SELECT user_id, password, salt,ec_salt " .
					" FROM " . $this->table($this->user_table).
					" WHERE user_name='$post_username' or mobile_phone='$post_username' or email='$post_username'";

2.在includes/modules/integrates/integrate.php中,找到

    /* 会员邮箱的字段名 */
    var $field_email    = '';
在下方添加
    /* 会员手机的字段名 */
    var $field_phone    = '';
找到
function login($username, $password, $remember = null)
下面的
		if ($this->check_user($username, $password) > 0)
		{
在下面添加
			$sql = "SELECT " . $this->field_name .
					" FROM " . $this->table($this->user_table).
					" WHERE " . $this->field_phone . " = '$username' or " . $this->field_name . " = '$username' or " . $this->field_email . " = '$username'";
			$username = $this->db->getOne($sql, true);
找到
function check_user($username, $password = null)
下面的
			$sql = "SELECT " . $this->field_id .
					" FROM " . $this->table($this->user_table).
					" WHERE " . $this->field_name . "='" . $post_username . "'";
替换为
			$sql = "SELECT " . $this->field_id .
					" FROM " . $this->table($this->user_table).
					" WHERE " . $this->field_name . "='" . $post_username . "' or " . $this->field_phone . "='" . $post_username . "' or " . $this->field_email . "='" . $post_username . "'";
找到
			$sql = "SELECT " . $this->field_id .
					" FROM " . $this->table($this->user_table).
					" WHERE " . $this->field_name . "='" . $post_username . "' AND " . $this->field_pass . " ='" . $this->compile_password(array('password'=>$password)) . "'";
替换为
			$sql = "SELECT " . $this->field_id .
					" FROM " . $this->table($this->user_table).
					" WHERE (" . $this->field_name . "='" . $post_username . "' or " . $this->field_phone . "='" . $post_username . "' or " . $this->field_email . "='" . $post_username . "') AND " . $this->field_pass . " ='" . $this->compile_password(array('password'=>$password)) . "'";
再找到
function sync ($username, $password='', $md5password='')
下面的
		$sql = "SELECT user_name, email, password, sex, birthday".
				" FROM " . $GLOBALS['ecs']->table('users').
				" WHERE user_name = '$username'";
替换为
		$sql = "SELECT user_name, email, password, sex, birthday".
				" FROM " . $GLOBALS['ecs']->table('users').
				" WHERE user_name = '$username' or mobile_phone = '$username' or email = '$username'";
安装完毕!

转载自http://www.ecshop119.com/ecshopjc-299.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值