ucenter synchronous login mechanism_PHP tutorial
Most friends who are engaged in PHP development know that there is ucenter, which can be used to log in and log out of multiple sites at the same time, and synchronize users. Next, the author will share with you how ucenter implements synchronous login.
First of all, the site must introduce a client such as uc_client. Taking login as an example, an external function will be called first when logging in. uc_user_login under uc_client/client.php checks whether this user exists. If it is correct, continue to execute the login code. , detect this user process: according to how the user connects to uc (mysql or http post), and then use different functions to detect the user accordingly. After the detection is completed, local login is implemented, the code is written by oneself, and then other applications are also logged in. , at this time the external function uc_user_synlogin is called, the process is as follows:
Uc_user_synlogin calls uc_api_post to implement which module to use. For example, it is the user module now, and the parameter passed is user_id. I don’t look at the details of how this is implemented. In short, the data is sent to uc_api, which is your ucenter address. index.php, and also attaches some parameters. Based on these parameters, it reads all the communicable applications in it and allows them to log in. This is a matter for other programs.
Notifying other applications mainly uses ucenter to send some data to api/uc.php under each application. The data is received by uc.php and then performs corresponding login operations.
This is what I wrote. It’s basically the same as his. I wanted to write down every function in detail but I’m a little tired today. Haha, it’s easy to find it yourself.
1. Start with user xxx entering the user name and password in login.php of a certain application. First use the uc_user_login function to verify the user and password on the uc server. If correct, write the session, write cookies, and update the login IP and login time in the application membership table. The user cannot feel this process.
2. Then notify the uc server through uc_user_synlogin that user xxx has successfully logged in. This process may use ajax, and the user will not feel the notification process.
3. After receiving this message, the uc server immediately ordered its subordinates to send the xxx login message, like a token ring, to all other applications that are willing to receive this message (whether the synchronous login is enabled in the background). In fact, it is to access the uc.php of each application with parameters, and the user cannot feel this process.
4. Each application relies on uc.php under the API to receive messages from the uc server, obey the instructions of the uc server, and do whatever it asks. Now, after receiving the command for user xxx to log in to your program, execute it immediately. And write the session of this application, and use p3p to write cookies in the same domain or different domains. The user cannot feel this process.
5. Finally, all programs integrated with uc, xxx logged in successfully. After the user logs in from www.phpernote.com/bbs, the login is also displayed when jumping to www.phpernote.com/. Because both the bbs and news systems are logged in in the background.
6. The session between the application and the uc server ends.
Articles you may be interested in
- How to remove ads from dedeCMS background login page
- php Output Control In-depth understanding of the difference between ob_flush and flush
- It is dangerous for multiple URLs on a website to access the same content
- The difference between synchronous requests and asynchronous requests in http requests
- JS setInterval and setTimeout usage analysis
- Solution to the "Invalid parameter encountered" error that pops up when CuteFTP connects to the ftp server
- The usage and difference of using break, continue, goto, return, exit to jump out of multiple loops in PHP
- mysql The usage differences between tinyint, smallint, int and bigint types

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

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

Generally speaking, we only need to use one of the headphones or speakers at the same time. However, some friends have reported that in the win11 system, they encountered the problem of headphones and speakers sounding at the same time. In fact, we can turn it off in the realtek panel and it will be fine. , let’s take a look below. What should I do if my headphones and speakers sound together in win11? 1. First find and open the "Control Panel" on the desktop. 2. Enter the control panel, find and open "Hardware and Sound" 3. Then find the "Realtek High Definition" with a speaker icon. Audio Manager" 4. Select "Speakers" and click "Rear Panel" to enter the speaker settings. 5. After opening, we can see the device type. If you want to turn off the headphones, uncheck "Headphones".

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.

When you find that one or more items in your sync folder do not match the error message in Outlook, it may be because you updated or canceled meeting items. In this case, you will see an error message saying that your local version of the data conflicts with the remote copy. This situation usually happens in Outlook desktop application. One or more items in the folder you synced do not match. To resolve the conflict, open the projects and try the operation again. Fix One or more items in synced folders do not match Outlook error In Outlook desktop version, you may encounter issues when local calendar items conflict with the server copy. Fortunately, though, there are some simple ways to help

MySQL is a very popular open source relational database management system that is widely used in various web applications, enterprise systems, etc. In modern business application scenarios, most MySQL databases need to be deployed on multiple servers to provide higher availability and performance, which requires MySQL data migration and synchronization. This article will introduce how to implement MySQL data migration and synchronization between multiple servers. 1. MySQL data migration MySQL data migration refers to the data migration in the MySQL server.
![GeForce Experience login freezes [Fix]](https://img.php.cn/upload/article/000/887/227/171084420790568.png?x-oss-process=image/resize,m_fill,h_207,w_330)
This article will guide you to solve the GeForceExperience login crash issue on Windows 11/10. Typically, this can be caused by unstable network connections, corrupted DNS cache, outdated or corrupted graphics card drivers, etc. Fix GeForceExperience Login Black Screen Before starting, make sure to restart your internet connection and computer. Sometimes, the problem may just be due to a temporary issue. If you are still experiencing NVIDIA GeForce Experience login black screen issue, please consider taking the following suggestions: Check your internet connection Switch to another internet connection Disable your

Wegame is a software used with Tencent games. You can use it to start games and gain acceleration. Recently, many users have experienced prompts that login operations are too frequent when using it. Faced with this prompt, many users do not know How can we solve it successfully? In this software tutorial, we will share the solution with you. Let’s learn about it together. What should I do if Wegame login operations are too frequent? Method 1: 1. First, make sure our network connection is normal. (You can try opening the browser to see if you can access the Internet) 2. If it is a network failure, then try restarting the router, reconnecting the network cable, and restarting the computer to solve the problem. Method 2: 1. If there is no problem with the network, then select &

How to change the default picture background when logging in to win7 system? Tutorial sharing on how to change the default picture background when logging in to win7 system. After setting a login password for our computer, when we turn on the computer and go to the login interface, there will be a picture background. Some users want to modify the background, so how can they modify the background? Many friends don’t know how to operate in detail. The editor below has compiled the steps to change the default picture background when logging in to the win7 system. If you are interested, follow the editor and take a look below! Steps to change the default picture background when logging in to the win7 system 1. First, go to the illustrated path C:WindowsSystem32oobeinfoackgrounds
