Table of Contents
ucenter communication principle, ucenter
Why does the UCenter user management center always display "communication failure" when adding daily group purchases and Note Dog Weibo? How to solve it? High score answer
I am a second-year communication engineering major and teach unofficial answers. What is the purpose of learning communication principles? In what jobs would it work?
Home Backend Development PHP Tutorial ucenter communication principle, ucenter_PHP tutorial

ucenter communication principle, ucenter_PHP tutorial

Jul 13, 2016 am 10:20 AM
discuz principle document user Log in communication pass

ucenter communication principle, ucenter

1. The user logs in to discuz and verifies the posted data through the function uc_user_login in the logging.php file, that is, verifying the username and password.

2. If the verification is successful, the function uc_user_synlogin located in the client.php file under uc_client will be called. In this function, uc_api_post('user', 'synlogin', array('uid'=>$ uid)).

3. Then this function passes data to index.php of Ucenter. Index.php accepts the passed data and obtains the value of model as user and action as synlogin.

4. Then Ucenter’s index.php calls the onsynlogin method in the user.php class in the control directory, and uses javascript to notify the applications in the uc application list that enable synchronous login through the foreach loop to log in synchronously; That is, some data is passed to uc.php under the api in each application directory through get method.

5. uc.php receives the notification and processes the data obtained, and encrypts the data through the function _authcode in the function synlogin (located in uc.php) (default uses UC_KEY as the key), and uses the function _setcookie Set cookies.

6. Each application uses the corresponding key to decode the cookie set above and obtain the user ID and other data; use this value to determine whether the user has logged in through other applications, so that the user can log in automatically.

Logging.php in application ------>client.php in uc_client------>Ucenter------>api/ in other applications uc.php.

In fact, the principle of Ucenter to achieve synchronous login is cookie. After an application successfully logs in, it transfers data to Ucenter and lets Ucenter notify other applications to also set cookies, so that users can use the cookies that have been set when accessing other applications. Cookie enables automatic login.

General steps, first install ucenter and then copy the uc_client folder to your own project, and then configure several files

client.php is equivalent to the function library

uc.php is equivalent to the callback file

config.php is the configuration file


When you have two applications set up to synchronize login, when you log in to an application, then execute

include './config.inc.php';
include './uc_client/client.php';
$usernames=" kyee";
$passwords="123456";
list($uid, $username, $password, $email) = uc_user_login($usernames, $passwords );
if($uid > 0) {

setcookie("username",$username,time()+intval(24*3600));
echo uc_user_synlogin($uid);
echo 'Login successful';
} elseif($uid == -1) {
echo 'The user does not exist or has been deleted';
} elseif($uid == -2) {
echo 'wrong password';
} else {
echo 'undefined';
}


uc_user_synlogin() This function represents the synchronous login to all other functions that enable synchronous login. uc itself will loop through all the applications that enable synchronous login in the background and then output it on the page

<script type="text/javascript" src="http://rayibeauty.ck101.com/api/uc.php?time=1408327309&code=bc6bFLa6WH343nin2GAn%2F82Y9cnCennPk1gcLGYHdQF4wsXsOSdTyqBb2Nuoxe0 UJqzWMWncdx%2FfQ1GK6FS%2BqJqi2AxVG2Oq1pD9c1wZy%2BgjXs7qo4mm2sxFVHwW7JnjKGPDkVdDqtYeybkSISz7yrdb0ZFuXH2yr3Cq " reload="1"></script>

<script type="text/javascript" src="http://kibeauty.ibeauty.tw/api/uc.php?time=1408327309&code=206flCqeb%2Faft%2FDFPno9Bvqsb1b0o6XTZdIByOoD7EC11vMrjzC7PaKLo0LF3tGiHwlwZ kwdW5VDHq866MGulsco5nekfkL341VWp7BPabnZPNtgG7m4jZpfdx6nVP0LTJLYI%2BkebI7uLm58atk8Ex4sKBj%2FfDkjH %2F8z" reload="1"></script>


JS code like this is sent to each application that enables synchronous login, and then the callback file uc.php of each application that enables synchronous login will be decrypted after receiving it. After decryption, you will actually You can write the code yourself. The code of this uc.php callback file does not have to be written in their format. You can also write your own code.


In fact, the principle of UC is very simple. After an application logs in, it then polls the callback file sent to the synchronously logged-in application in the background. After the callback file receives the user ID, it generates a cookie or session and then enters the login mode. .

Why does the UCenter user management center always display "communication failure" when adding daily group purchases and Note Dog Weibo? How to solve it? High score answer

Ucenter Communication Principle
wenku.baidu.com/...1.html

I am a second-year communication engineering major and teach unofficial answers. What is the purpose of learning communication principles? In what jobs would it work?

I am also a 2-book correspondent.
Studying communications in college is not only about choosing your own major, but also choosing your own career. Now that you have chosen it, you really have to study it with all your heart. Find a counterpart at work. If you are not interested now, you should cultivate your interest as soon as possible. Communication can be said to be a sunrise industry that will be lost forever, so as long as you learn it well, you don’t have to worry about not finding a good job!
There are many undergraduate courses, and each school is different. But there will definitely be some major basic courses. "Model Electricity", "Counting Points", "Signal System", "Principles of Communication". Especially signals, which are the theoretical basis of communication, must be learned well. In fact, to put it bluntly, it means learning mathematics well. No matter you want to take the postgraduate entrance examination or find a job in the future, you will definitely not suffer if you learn mathematics well. It is especially useful when taking postgraduate entrance examinations. Hey, let me express my feelings. There are many motivations for learning communications. First of all, if you work in the communications industry for more than 3 years, the salary is very high. What may seem profound to outsiders may appear to be very simple, which will give you a sense of accomplishment. The direct motivation is that you can go to large website forums such as Communication, or read introductory books such as "Dahua Communication".
Hope this information is useful to you.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/868763.htmlTechArticleucenter Communication Principle, ucenter 1. The user logs in to discuz, and uses the function uc_user_login in the logging.php file to post messages Verify the data, that is, verify the username and password...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use Xiaohongshu account to find users? Can I find my mobile phone number? How to use Xiaohongshu account to find users? Can I find my mobile phone number? Mar 22, 2024 am 08:40 AM

How to use Xiaohongshu account to find users? Can I find my mobile phone number?

What should I do if I download other people's wallpapers after logging into another account on wallpaperengine? What should I do if I download other people's wallpapers after logging into another account on wallpaperengine? Mar 19, 2024 pm 02:00 PM

What should I do if I download other people's wallpapers after logging into another account on wallpaperengine?

How do I log in to my previous account on Xiaohongshu? What should I do if the original number is lost after it is reconnected? How do I log in to my previous account on Xiaohongshu? What should I do if the original number is lost after it is reconnected? Mar 21, 2024 pm 09:41 PM

How do I log in to my previous account on Xiaohongshu? What should I do if the original number is lost after it is reconnected?

Log in to Ubuntu as superuser Log in to Ubuntu as superuser Mar 20, 2024 am 10:55 AM

Log in to Ubuntu as superuser

New generation of optical fiber broadband technology - 50G PON New generation of optical fiber broadband technology - 50G PON Apr 20, 2024 pm 09:22 PM

New generation of optical fiber broadband technology - 50G PON

How to transfer files from Quark Cloud Disk to Baidu Cloud Disk? How to transfer files from Quark Cloud Disk to Baidu Cloud Disk? Mar 14, 2024 pm 02:07 PM

How to transfer files from Quark Cloud Disk to Baidu Cloud Disk?

What to do if the 0x80004005 error code appears. The editor will teach you how to solve the 0x80004005 error code. What to do if the 0x80004005 error code appears. The editor will teach you how to solve the 0x80004005 error code. Mar 21, 2024 pm 09:17 PM

What to do if the 0x80004005 error code appears. The editor will teach you how to solve the 0x80004005 error code.

What is hiberfil.sys file? Can hiberfil.sys be deleted? What is hiberfil.sys file? Can hiberfil.sys be deleted? Mar 15, 2024 am 09:49 AM

What is hiberfil.sys file? Can hiberfil.sys be deleted?

See all articles