Please verify that the user is logged in which way is good

Source: Internet
Author: User
Ask to verify that the user is logged in which way is good
Remember me, auto login
1, pure cookie encryption (assuming that the case does not know the key can not be decrypted)
Cookie2 a section
1 is the basic information of the encrypted user, such as ID, group, logon time, expiration time
2 is an irreversible hash, with ID, browser features, user unique Rand, key composition
Issue: When a user is disabled or the user group expires, the user can still be authenticated and free to be active by login before the expiration time.
2, Cookie+session
Question: Same 1
3. cookie+ Database
Problem: Each verified page needs to read the database, late pressure, feeling is not a good solution
4. cookie+ Custom Session Cache file
After the user's initial login, the user table is written to the session file name, and when a user is disabled, the corresponding session files are rewritten.
Issue: After updating user information, such as change user group, need to determine whether there is a cache file, and then do the corresponding update
5. cookie+ Cache Table
After the user first logs on, the cache table is written, and when a user is disabled, the corresponding cache table is updated
Issue: After updating the user information, such as changing the user group, you need to determine the cache table and then do the corresponding update.
6. Cookie+memcached Class Cache
Problem: not suitable for small memory or virtual host
7. Thank you for your supplementary
------to solve the idea----------------------
Recommended session
------to solve the idea----------------------
2 better, write the disabled user into the cache, and when you log in, check to see if it is disabled.
  • Related Article

    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.