ECSHOP用户名、手机号、电子邮箱登陆插件

更新时间:2016-07-01 点击量:1823

  
 
这个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插件,实用性文章尽在优易软件

支付宝扫码打赏 微信打赏

如果文章对您有帮助,就打赏一个吧

相关联的商品

在线客服

客户服务

热线电话:

13128985956 服务时间:

周一到周六:9:00-18:00

在线QQ客服

在线微信客服

关于我们 常见问题

支付方式 加盟合作

提交需求
优惠红包 购物车0 反馈留言 返回顶部