Discuz Determine user Login

Source: Internet
Author: User

In the include/common.inc.php file. The program begins by determining if there is a cookie stored in the SID value, and then decrypts the cookie[' auth '] This user login state to encrypt the string, and if decrypted there is a UID value indicating that the user is logged in. The next step is to get basic information about the user. If there is a UID then go directly to the members table, if not, then according to whether there is a SID value to sessions table lookup (if there is a SID, then to sessions, because in the process of page execution footer.html template execution The Updatesession function, the function is to record the online user, sid as the keyword, if logged in together with the user information, if not only the SID value, or the SID as the table search primary keyword inserted a new record. This explains why the above mentioned why when there is no UID value when there is a SID value to the session to check the user information, or no user information to determine the user is not logged in.
When this entire execution has no SID value and no user information indicates that the user first logs on or the cookie value has expired, random (6) randomly gives the 6-digit number to the $SID variable, The SID value is then stored with a cookie when the common.inc.php program is about 300 lines in which the SID value is determined and no cookie (' SID ') value is present. This allows the user to have a SID value (unless it has expired) when they visit again. In this case, use this user in sessions, then write down the current number of people online.
In the login function of the synchronous login, the cookie (' Sid ', ', ', -84000*365) is dropped, and the other normal cookie is understood for a long time. My understanding is: Since the user does not log in Discuz, is to log in elsewhere, it indicates that he has not been in the forum (or so forcibly specified not browsed, regardless of the previous browsing, there are SID values. Because the Updatesession function will delete the record of the user who is not online for 15 minutes) or force the SID to regenerate. Reinsert a new record into the sessions table.

Discuz Determine user Login

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.