ecshop

ECSHOP用户名、手机号、email登陆插件

ECSHOP教程 来源: ECSHOP教程网www.ecshop119.com 时间:2013-11-22 ECSHOP教程分类:ECSHOP用户中心修改

该ECSHOP插件仅适用于没有做过任何平台整合的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->need_sync)
   {
          $this->sync($username,$password);
   }

在上面增加

   $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'";


安装完毕!

转载请注明:ECSHOP模板屋-ECshop教程网https://www.ecshop119.com/ecshopjc-299.html

ECSHOP
ecshop下载 ecshop安装教程 ecshop在线演示 ecshop后台测试
ECSHOP二次开发手册
ecshop教程 ecshop二次开发 ecshop模板教程 ecshop微信配置
ECSHOP商城网站建设
ecshop空间域名 ecshop商城建设 ecshop模板修改 ecshop开发定制
ECSHOP模板屋
ecshop开发团队 ecshop开发中心 ecshop模板制作 模板屋简介
服务支持:7X24小时 151 059 55077
ECShop二次开发
ecshop搭建
qqtelcodeback_top
温馨提示

确定取消
温馨提示

关闭