Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Turn off the registration mailbox verification of the discuzX3.2 registration page

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Forum upgrade found that registered users in the input of any email email, has been prompted email address is invalid. Using firephp tracking, we found that the suffix of randomly generated email is @ localhost!

Find the reason and modify it as follows:

/ / original code if (empty ($email) & & $_ G ['setting'] [' forgeemail']) {$_ GET ['email'] = $email = strtolower (random (6)). @. $_ SERVER [' HTTP_HOST'] } / / but if the local debug emai suffix is @ localhost, it does not conform to the mailbox rule if (empty ($email) & & $G ['setting'] [' forgeemail']) {$_ GET ['email'] = $email = strtolower (random (16)). @'. 'klaus.com';} / / adds a 16-bit random code to reduce the probability of generating the same mailbox / / the suffix is fixed so that the Email address is not valid!

But this feeling is too low, back to dz3.1 before the game is:

In the backend of the previous version of DZ3.2, we can cancel mailbox registration globally-- Registration and access-- as shown below:

Then comes the problem. The official Discuz team may have considered this problem, and maybe they, like me, thought that it was not necessary for this place to appear in the background, so they updated the module in the X3.2 version. I think the result of the update should be like this: cancel this setting in the background, but the information stored in the database remains the same. And the values set in this database are no longer used when registering. This creates the above problems, although it makes users feel that they do not need to fill in (because there is no red star), but after not filling in, they cannot register.

Analysis of problems

Through the analysis of the X3.1 background settings, it is found that here is a radio type, that is, the switch (just nonsense, anyone can see); the form name is settingnew [forgeemail], the values of 0 and 1 are closed and 1 is open, which is the same as the general habit. That is to say, when this value is 1, we do not need to fill in the mailbox when we register, on the contrary, by default, we have to fill in the mailbox to register the account.

Students who have done the secondary development of Discuz should know that, in fact, setting data like this in the background is stored in the common_setting data table, and soon I found that there is a record of forgeemail directly in this data table, indicating that the dz in this place is directly saved (do not want to save highlight information like that, but also through binary conversion, , no longer need to look at the source code). As shown below (of course, below is the default)

Problem solving

At this point, you should understand what the problem is, in fact, the problem is that the record of skey as forgeemail in this data table after 3.2is only used to determine whether there is a red star, not whether it is really to be filled in. In other words, no matter whether you set 0 or 1 here, you have to fill in your mailbox when you register for your site (this may also be something that the DZ team ignored in the issue of upgrade and change, for example, even if the mandatory design is required, then the value of this field in the database should be automatically overwritten to 0 when upgrading).

So if you completely solve the problem (that is, you can enable users to register without having to fill in your mailbox), this is relatively complicated, and it is necessary to modify the verification procedure of your registration form, and I personally do not recommend it. I won't go into details here.

Then the next step is to register with a red star (which is actually the default). Of course, the problem is for sites that have set this value through the background before 3.2. So now go to the database to find common_setting, the data table, find the skey value of forgeemail, and change the svalue to the default 0. You can also run the following sql statement in the database management tool or website background.

Update pre_common_setting set 'svalue'='0' where' skey'='orgeemail' Note: the table here is prefixed with the default pre_, of DZ. If you modify it, change it to your new one.

The discuzX3.2 backend turns off the required options for registering mailboxes. The detailed process is as follows:

Step 1:source/admincp/admincp_setting.php file

Find:

Showsetting ('setting_access_register_send_register_url',' settingnew [sendregisterurl]', $setting ['sendregisterurl'],' radio')

About 440-441 lines:

Add the following code:

Showsetting ('setting_access_register_forge_email',' settingnew [forgeemail]', $setting ['forgeemail'],' radio')

Step 2: open the source/language/lang_admincp.php file

Find: only one account can be registered in a mailbox

About 811 lines, add the following code:

'setting_access_register_forge_email' = >' unregistered mailbox is required', 'setting_access_register_forge_email_comment' = >' if you do not fill in the registered mailbox after opening it, an email address will be generated automatically'

Step 3: modify source/class/class_member.php

About 611 lines:

The original text is:

$email = strtolower (trim ($_ GET ['email']); if (empty ($this- > setting [' ignorepassword'])) {if ($_ GET ['password']! = = $_ GET [' password2']) {showmessage ('profile_passwd_notmatch');} if (! $_ GET [' password'] | | $_ GET ['password']! = addslashes ($_ GET [' password'])) {showmessage ('profile_passwd_illegal');} $password = $_ GET [' password'] } else {$password = md5 (random (10));}}

Change to (or directly replace the following:)

$email = strtolower (trim ($_ GET ['email'])); if (empty ($email) & & $_ G [' setting'] ['forgeemail']) {$_ GET [' email'] = $email = strtolower (random (6)). @. $_ SERVER ['HTTP_HOST'] } if (empty ($this- > setting ['ignorepassword']) {if ($_ GET [' password']! = = $_ GET ['password2']) {showmessage (' profile_passwd_notmatch');} if (! $_ GET ['password'] | | $_ GET [' password']! = addslashes ($_ GET ['password']) {showmessage (' profile_passwd_illegal');} $password = $_ GET ['password'] } else {$password = md5 (random (10));}}

Tools-> update cache:

Global-> Registration and access Control:

If you want to not show the registration email option on the registration page, just remove the corresponding email code from the template.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report