Functions implemented in this article:
1. Enter the forum from the original system to automatically log in and register
2. Implement pop-up boxes on this page without jumping
3.js directly initiates a registration request when the page is loaded
This function was previously handled by the
uc_user_registerfunction, but today it will be used when developing user space problem appear.
Project requirements
Add a forum to our original system, but user information needs to be shared.
Implementation method: Bring the user information of the original system when entering the forum, and then get the information from the forum and register directly.
Enter the forum from the original system to automatically register and log in
Prepare such a buffer page and put it in upload/template/default/touch/member/ In the page of register.htm

then we need to put the original registration code into upload/template/default /touch/member/register.htm
The reason for putting this code is thatdsicuzThere will be many parameter restrictions when submitting the form, we can just keep it as it is.
<form method="post" autocomplete="off" name="register" id="registerform" action="member.php?mod={$_G[setting][regname]}&mobile=2">
<input type="hidden" name="regsubmit" value="yes" />
<input type="hidden" id="hash" name="formhash" value="{FORMHASH}" />
<!--{eval $dreferer = str_replace('&', '&', dreferer());}-->
<input type="hidden" id="referer" name="referer" value="$dreferer" />
<input type="hidden" name="activationauth" value="{if $_GET[action] == 'activation'}$activationauth{/if}" />
<input type="hidden" name="agreebbrule" value="$bbrulehash" id="agreebbrule" checked="checked" />
<!--{if $_G['setting']['sendregisterurl']}-->
<input type="hidden" name="hash" value="$_GET[hash]" />
<!--{/if}-->
<!--{if $secqaacheck || $seccodecheck}-->
<!--{subtemplate common/seccheck}-->
<!--{/if}-->
</div>
</form>Then we need to directly send a request when the page is loaded, just add the following code.
Implement the pop-up box on this page, without jumping, and directly initiate a registration request when loading
The function implemented by this js code: directly initiate a registration request when the page is loaded, and then return the information , displayed directly on this page instead of jumping to another page
<script>
var hash = $('#hash').val();
var referer = $('#referer').val();
$.ajax({
type:'POST',
url:"member.php?mod={$_G[setting][regname]}&mobile=2" +'&inajax=1',
data:{
"handlekey":"registerform",
"inajax" : 1,
"regsubmit" :"yes",
"formhash":hash,
"referer" :referer
},
dataType:'xml'
})
.success(function(s) {
popup.open(s.lastChild.firstChild.nodeValue);
evalscript(s.lastChild.firstChild.nodeValue);
})
.error(function() {
window.location.href = obj.attr('href');
popup.close();
});
</script>The last step required at this time is what form to use to transmit it from the original system. This method is not provided here. I will make a simulated data.
Add your own code according to the comments in the upload/source/module/member/member_register.php method on_register

Test the effect
We register a ceshi123 account

Test post

##Why not useuc_user_register The reason for this method to register users
uc_user_register is used to register users directly, all the following information will not be obtained

The above is the detailed content of How discuz implements automatic registration and login. For more information, please follow other related articles on the PHP Chinese website!

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Linux new version
SublimeText3 Linux latest version

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software






