如何实现ecshop 让用户名和email都可以登陆
下面分享一个ecshop用户名和Email同时登陆的
改动程序: /includes/modules/integrates/integrate.php
改动代码:145–162行的用户登陆函数.如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | function login($username, $password, $remember = null) { 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; } } |
改为
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | function login($username, $password, $remember = null) { 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; } } |
来源:邦林织梦(微信/QQ号:909912499),欢迎分享本文,转载请保留出处!部分内容来自网络,如有侵权请联系删除处理!
本站提供代码修改,dedecms,WordPress仿站二次开发 / PHP网站建设以及SEO优化等网络营销推广等服务。
如有需要请加QQ: 909912499