- /template/default/member/login.htm 登录模板
https://www.dede58.com.cn/dz7top-dztemplate.html
找到如下代码:
- <option value="email">{lang email}</option>
在后面加上一句:
- <option value="mobile">手机</option>
修改后保存:
第二步:修改登录流程
打开source\function\function_member.php
搜索代码:
- userlogin($username, $password, $questionid,
- if($loginfield == 'uid' && getglobal('setting/uidlogin')) {
- $isuid = 1;
- } elseif($loginfield == 'email') {
- $isuid = 2;
- } elseif($loginfield == 'auto') {
- $isuid = 3;
- } else {
- $isuid = 0;
- }
修改为:
- if($loginfield == 'uid' && getglobal('setting/uidlogin')) {
- $isuid = 1;
- } elseif($loginfield == 'email') {
- $isuid = 2;
- } elseif($loginfield == 'auto') {
- $isuid = 3;
- } elseif($loginfield == 'mobile') {
- $isuid = 4;
- } else {
- $isuid = 0;
- }
修改后保存!
第三步:修改UC流程
打开uc_client\control\user.php
搜索:
- $user = $_ENV['user']->get_user_by_uid($username);
- if($isuid == 1) {
- $user = $_ENV['user']->get_user_by_uid($username);
- } elseif($isuid == 2) {
- $user = $_ENV['user']->get_user_by_email($username);
- } else {
- $user = $_ENV['user']->get_user_by_username($username);
- }
- if($isuid == 1) {
- $user = $_ENV['user']->get_user_by_uid($username);
- } elseif($isuid == 2) {
- $user = $_ENV['user']->get_user_by_email($username);
- } elseif($isuid == 4) {
- $user = $_ENV['user']->get_user_by_mobile($username);
- } else {
- $user = $_ENV['user']->get_user_by_username($username);
- }
第四步:添加登陆模型
打开uc_client\model\user.php
搜索:
- function get_user_by_uid($uid)
- function get_user_by_uid($uid) {
- $arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."members WHERE uid='$uid'");
- return $arr;
- }
在他的上面或者下面添加如下代码
- function get_user_by_mobile($mobile) {
- $arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."members WHERE mobile='$mobile'");
- return $arr;
- }
然后保存!