PHP Close browser automatically trigger exit link code how to write?

Source: Internet
Author: User
I now system member login, directly close the browser and then open the site do not need to log in again, I want him to directly close the browser next open also want to log in, the site has write exit button function (such as), there is no code in the browser when the automatic trigger exit link exit, the next time you open the browser will be re-login.


Reply to discussion (solution)

Using the session instead of Cookie,session is to close the page and exit ...

On the upstairs, you change the cookie to session,cookie the session time can be set, when the set time is not expired, even if the browser is closed, the next time the visit, or do not need to enter the account password, with the session, close the browser, the session will be destroyed.

The login information is saved in the cookie, the browser closes, and the cookie disappears.

Using the session instead of Cookie,session is to close the page and exit ...
The problem is I don't know how to write, can you tell me?


Using the session instead of Cookie,session is to close the page and exit ...
The problem is I don't know how to write, can you tell me?
How to write to see your original code, it is relatively simple to read into the account password cookies two sentences to comment off the line

It would be nice to hide the Setcookie and cookie statements.

1. As LS says, use the session
2. If you do not want to consume server resources, use JavaScript to determine if the browser shuts down and then destroys the cookie.

  • 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.