Close the registration email verification of the discuzX3.2 registration page

Source: Internet
Author: User

Forum after the upgrade found that registered users in the input of any email message, has been prompted email address is invalid . Tracking with firephp: The suffix of randomly generated email is @localhost!

Find the cause and modify it as follows:

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:0px; "/>

Original code if (empty ($email) && $_g[' setting ' [' Forgeemail ']) {$_get[' email '] = $email = Strtolower (random (6)). ' @ '. $_server[' Http_host ');} However, if the local debug emai suffix is @localhost, the rules that do not conform to the mailbox (empty ($email) && $_g[' setting ' [' Forgeemail ']) {$_get[' email '] = $ email = strtolower (random (16)). ' @‘.‘ Klaus.com ';} Added 16 random code, reduce the generation of the same mailbox probability,//suffix fixed, so that does not prompt ' Email address invalid '!

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:0px; "/>

But this feeling is too lower, back to dz3.1 before the play is:

In the background of the previous version of DZ3.2 we can be in the global--registration and access--Cancel the mailbox registration must fill in as follows:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1102222/201704/ 1102222-20170407163328519-941355539.png "style=" border:0px; "/>

Then there's the problem, and Discuz's official team may have taken this into account, and maybe they think it's not much of a necessity in the background as I do. So they updated the module in the X3.2 version, the results of the update I think it should be: in the background to cancel this setting, but the information stored in the database is not changed, and at the time of registration no longer use the value of the settings in this database is based on. So it caused the above problem, although let the user feel no need to fill (because no Red Star), but not to register after

Problem analysis

Through the X3.1 background settings analysis found here is a radio type, that is, the switch (nonsense, who can see); the form name is Settingnew[forgeemail], the value is 0 and 1,0 is off, 1 is open, this is the same as the general habit. That is, the value of the selection 1 o'clock when we register can not need to fill out the mailbox, and vice versa is the default we must fill in the mailbox to register the account.

and have done discuz two times the development of the students should be clear, in fact, the background similar to such settings data are stored in common_setting this data table, and soon I found that the data table directly has forgeemail this record, This place DZ is directly saved (do not want to save the highlight value information, but also through the conversion, haha, no longer see the source code to go). such as (of course the following is the default appearance)
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1102222/201704/ 1102222-20170407163550441-2145567275.png "style=" border:0px; "/>

Problem solving

Speaking of which, we should understand what the problem is, In fact, the problem is that the skey in this data table after 3.2 is only used to determine whether to take the Red Star, but not to determine if it is really required, in other words, whether it is set 0 or 1, your website will have to fill in the mailbox (this may also be the DZ team in the upgrade to change the issue of the neglected place, For example, even if mandatory design is required, then the database should also be the field value in the upgrade when the automatic coverage of 0).

Then if the complete solution (that is, you can make your site implementation users do not have to fill out the mailbox can also register), this relatively complex, to modify your registration form verification procedures, and I personally do not recommend this, here is not detailed.

Then the next step is to take the registration time with the Red Star (in fact, the default is this), of course, the problem is to set the value before 3.2 through the background of the site. So now go to the database to find common_setting this data table found Skey value Forgeemail svalue changed to the default 0, you can also run the following SQL statement in the Database management tool or the Web site background

Update pre_common_setting set ' svalue ' = ' 0 ' where ' skey ' = ' orgeemail ' Note: The table prefix here is the default pre_ for DZ, if you modify it, change it to your newly modified

discuzX3.2 background to turn off the ability to register the mailbox required options. The detailed procedure is as follows:
Step 1:source/admincp/admincp_setting.php File
Find:

Showsetting (' Setting_access_register_send_register_url ', ' settingnew[sendregisterurl] ', $setting [' Sendregisterurl '], ' radio ');

It's 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: One mailbox allows only one account to be registered

About 811 lines, add the following code:

' Setting_access_register_forge_email ' = ' Cancel registered email must be filled ', ' setting_access_register_forge_email_comment ' and ' = ' After opening, if you do not fill in the registered mailbox, will automatically generate an email address ',

Step 3: Modifysource/class/class_member.php
About 611 Lines:
The original text is:

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:0px; "/>

$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)); }}

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:0px; "/>

Modify to (or replace directly the following:)

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:0px; "/>

$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 (' prof    Ile_passwd_notmatch '); } if (!$_get[' password ') | | $_get[' password ']! = addslashes ($_get[' password '])) {showmessage (' Profile_passwd_    Illegal '); } $password = $_get[' password ');} else {$password = MD5 (random (10));}}

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" border:0px; "/>

Update Cache with tools:
Global registration and access control:
650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/1102222/201704/ 1102222-20170407165201769-761152476.png "style=" border:0px; "/>

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


Close the registration email verification of the discuzX3.2 registration page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.