DZ注册和登陆流程的简单梳理
注册流程 第一步: /source/class/class_member.php: on_register注册入口 L602 左右 if(!$activation) {//不为空,说明用户已经注册过 //将用户注册到用户中心,调用第二步uc_user_register方法 $uid = uc_user_register(addslashes($username), $password,
注册流程
第一步:
/source/class/class_member.php: on_register注册入口
L602 左右
if(!$activation) {//不为空,说明用户已经注册过
//将用户注册到用户中心,调用第二步uc_user_register方法
$uid = uc_user_register(addslashes($username), $password, $email, $questionid, $answer, $_G['clientip']);
第二步:
/uc_client/client.php: uc_user_register 调用将用户注册到用户中心的方法,调用第三步的onregister方法
第三步:
/uc_client/control/user.php: onregister 将用户注册到用中心,调用第四步add_user方法
第四步:
/uc_client/model/user.php:add_user 将用户注册到ucenter返回用户id
第五步:
/source/class/class_member.php:
L685行 左右,会把用户信息写到common_member表。注册结束
C::t(‘common_member’)->insert($uid, $username, $password, $email, $_G['clientip'], $groupinfo['groupid'], $init_arr);
登陆流程
第一步:
/source/class/class_member.php: on_login ?登陆入口
87行左右,调用userlogin方法如下:
$result = userlogin($_GET['username'], $_GET['password'], $_GET['questionid'], $_GET['answer'], $this->setting['autoidselect'] ? ‘auto’ : $_GET['loginfield'], $_G['clientip']);
第二步:
/source/function/function_member.php: logincheck
72行左右 调用 logincheck,如下:
if(!($_G['member_loginperm'] = logincheck($_GET['username']))) {
showmessage(‘login_strike’);
}
第三步:
/source/function/function_member.php: userlogin ?用户登陆查询相关表
第29行-40行左右会用调用uc_user_login方法
if($isuid == 3) {
if(!strcmp(dintval($username), $username) && getglobal(‘setting/uidlogin’)) {
$return['ucresult'] = uc_user_login($username, $password, 1, 1, $questionid, $answer, $ip);// uc_client/client.php
} elseif(isemail($username)) {
$return['ucresult'] = uc_user_login($username, $password, 2, 1, $questionid, $answer, $ip);// uc_client/client.php
}
if($return['ucresult'][0]
$return['ucresult'] = uc_user_login(addslashes($username), $password, 0, 1, $questionid, $answer, $ip);
}
} else {
$return['ucresult'] = uc_user_login(addslashes($username), $password, $isuid, 1, $questionid, $answer, $ip);
}
/uc_client/client.php: 包含uc_开头的全部方法,例uc_user_login
/uc_client/control/user.php: onlogin 根据条件判断登陆,114-120 判断查询条件查询出ucenter用户信息
/uc_client/model/user.php 包含有get_user_by_uid,get_user_by_username 等方法 第50行左右查询common_member表,如下:
$member = getuserbyuid($return['ucresult']['uid'], 1);
回到/source/class/class_member.php文件on_login方法
第95-106 行左右会根据条件$result['status']==-1 ,写common_member表,并查询出写入信息
C::t(‘common_member’)->insert($uid, $result['ucresult']['username'], md5(random(10)), $result['ucresult']['email'], $_G['clientip'], $groupid, $init_arr);
$result['member'] = getuserbyuid($uid);
————————————————————————————-
ps:以上所有方法都会先执行
/source/class/discuz/discuz_application.php: _init_user
所以如果要自己写checklogin 可以考虑从_init_user 方法入手
如果与自己的平台做bbs的打通。
注册可以考虑在第4步做操作,调用自己平台的注册接口。注册用户,并将用户id返回。写入到ucenter
/uc_client/model/user.php:add_user 方法内
登陆打通可以考虑在 第三步调用 uc_user_login 方法前,
1.调用自己平台接口查询用户相关信息
2.查询ucenter中用户是否存在
3.如果不存在insert一条数据
4.common_member可以写也可以不写 ,如此时不写 $result['status']==-1 会在class_member 95-106 行左右写入
如果在自己平台处于登陆状态,在bbs也为登陆状态,则可以考虑从_init_user 方法入手。做登录判断
无法同步登陆需要注意检查的地方:
1.ucenter中应用的配置信息是否完全正确,并与目标站后台的ucenter接口配置信息一致。
2.如果遇到通信成功,但是一边能登陆一边无法同步登陆的情况,请首先检查 uc_client/data/cache/apps.php中的站点信息是否完全。
3.请注意编码以及程序的BOM头导致返回信息乱码的情况。
discuz快速找回管理员密码的方法
在网站根目录下的子目录uc_server/data中找到文件config.inc.php,打开它,找到类似以下代码:
define(‘UC_FOUNDERPW’, ’256955f2e034sad74f0e2953572ea360′);
define(‘UC_FOUNDERSALT’, ’217804′);
然后用以下代码替换上述代码:
define(‘UC_FOUNDERPW’, ’047099adb883dc19616dae0ef2adc5b6′);
define(‘UC_FOUNDERSALT’, ’311254′);
修改完后,Ucenter创始人的密码就变为:? 123456789 ,
这时可以登录到Ucenter里再把密码改为自己想要的就可以了。
其实方法有很多种,不过这种是最方便的。
原文地址:DZ注册和登陆流程的简单梳理, 感谢原作者分享。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Some players are experiencing a strange issue on PS4 or PS5 at launch. For example, this can cause distress when their PlayStation Network login fails, but their internet connection is fine. You may encounter errors when entering your login information and may not be able to join PSParty chat. If you encounter a similar problem, this guide may help you solve it. Next to PlayStationNetworkSign-in, you will see the error message ‘AnErrorHaveAreAre’ and it will say ‘Failure’. Other parameters like getting IP address, internet connection and connection speed were successful. So, what could be the problem here? I will give you a job

As a platform integrating social networking and e-commerce, Xiaohongshu has attracted more and more users to join. Some users hope to register multiple accounts to better experience interacting with Xiaohongshu. So, how to register multiple accounts on Xiaohongshu? 1. How to register multiple accounts on Xiaohongshu? 1. Use different mobile phone numbers to register. Currently, Xiaohongshu mainly uses mobile phone numbers to register accounts. Users sometimes try to purchase multiple mobile phone number cards and use them to register multiple Xiaohongshu accounts. However, this approach has some limitations, because purchasing multiple mobile phone number cards is cumbersome and costly. 2. Use email to register. In addition to your mobile phone number, your email can also be used to register a Xiaohongshu account. Users can prepare multiple email addresses and then use these email addresses to register accounts. but

The AADSTS7000112 error may prevent you from logging into the app using your Microsoft account, causing you inconvenience. This article will provide you with solutions to help you resolve this issue and restore a normal login experience. Login: Sorry, you are having trouble logging in. AADSTS7000112: Application disabled. Fortunately, you can fix the error by following some simple suggestions. What is error code AADSTS7000112? Error code AADSTS7000112 indicates a problem with the connection to Microsoft's Azure Active Directory. Typically, this may be due to the Microsoft application trying to log in being blocked.

On the Manwa Comics platform, there are rich comic resources waiting for everyone to explore. As long as you easily enter the official platform of Manwa Comics, you can enjoy all kinds of wonderful comic works. Everyone can easily find their favorite comics to read according to their own preferences. So how to register the official account of Manwa Comics? The editor of this website will bring you this detailed tutorial guide, hoping to help everyone in need. Manwa Comics-Official entrance: https://fuw11.cc/mw666 Manwa Comics app download address: https://www.siemens-home.cn/soft/74440.html Manwa Comics non-mainland area entrance: https: /

The hard disk serial number is an important identifier of the hard disk and is usually used to uniquely identify the hard disk and identify the hardware. In some cases, we may need to query the hard drive serial number, such as when installing an operating system, finding the correct device driver, or performing hard drive repairs. This article will introduce some simple methods to help you check the hard drive serial number. Method 1: Use Windows Command Prompt to open the command prompt. In Windows system, press Win+R keys, enter "cmd" and press Enter key to open the command

I don’t know if you have such an experience. Your mobile phone often receives some inexplicable text messages, or registration information for some websites or other verification information. In fact, our mobile phone number may be bound to many unfamiliar websites, and we ourselves Even if you don’t know, what I will share with you today is to teach you how to unbind all unfamiliar websites with one click. Step 1: Open the number service platform. This technique is very practical. The steps are as follows: Open WeChat, click the plus icon in the search box, select Add Friend, and then enter the code number service platform to search. We can see that there is a number service platform. Of course, it belongs to a public institution and was launched by the National Institute of Information and Communications Technology. It can help everyone unbind mobile phone number information with one click. Step 2: Check whether the phone has been marked for me

Xiaohongshu, a social platform integrating life, entertainment, shopping and sharing, has become an indispensable part of the daily life of many young people. So, how to register a Xiaohongshu account? 1. How to register a Xiaohongshu account? 1. Open the Xiaohongshu official website or download the Xiaohongshu APP. Click the "Register" button below and you can choose different registration methods. Currently, Xiaohongshu supports registration with mobile phone numbers, email addresses, and third-party accounts (such as WeChat, QQ, Weibo, etc.). 3. Fill in the relevant information. According to the selected registration method, fill in the corresponding mobile phone number, email address or third-party account information. 4. Set a password. Set a strong password to keep your account secure. 5. Complete the verification. Follow the prompts to complete mobile phone verification or email verification. 6. Perfect the individual

Some users find that they do not have an account when they want to use 163 mailbox. So what should they do if they need to register an account at this time? Now let’s take a look at the 163 email registration method brought by the editor. 1. First, search the 163 Email official website in the browser and click [Register a new account] on the page; 2. Then select [Free Email] or [VIP Email]; 3. Finally, after selecting, fill in the information and click [Now Just register];
