Check whether the logon status is correct.

Source: Internet
Author: User
Determine whether the logon status is in. for example, when I log on, I execute the sqlupdateusersetislogin = '1' where condition, but how can I set it to zero when I exit? If you click the exit button, you can still use SQL for update. However, if you do not click the exit button, you only need to check whether the account is logged on.
For example, when I log in
Execute SQL update user set islogin = '1' where condition

But how can I set it to zero when I exit?
If you click the exit button, you can still use SQL to update

However, if you do not click the exit button, but the session storage does not exist,
What should I do?

------ Solution --------------------
Cookie seesion sets the expiration time, because, for example, when the browser crashes, or is not properly closed, you cannot set the field in the database to 0.
------ Solution --------------------
Generally, session processing is used for this status. when the browser is closed, the "logon status" is automatically cleared.
------ Solution --------------------
Click exit.
Do not click the exit button, but the session does not exist:
You need to synchronize the session and database content. when you log on, you can determine that if this field in the session is 0, but this attribute field is 1 in the background database, the database field should be synchronized to 0, requiring the user to enter the user name and password to log on again

Session can also prevent at the same time with an account to log on, but is to squeeze the previous user, the specific method can see: http://www.cnblogs.com/heaiping/archive/2010/01/19/1651835.html
------ Solution --------------------
When exiting, pass a GET parameter

Then the GET parameter exists.
Execute the UPDATE statement + session_destroy ()
------ Solution --------------------
We recommend that you check the session mechanism.

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.