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