Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8882197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:31:00+00:00 2026-06-14T20:31:00+00:00

I am trying to create a login system using PHP and MySQL. I am

  • 0

I am trying to create a login system using PHP and MySQL. I am using cookies in order to keep the users logged in for a long period of time. The cookie has a randomly-generated string, which is also in the database. They are compared to each other and appropriate action is taken. Basically, it’s the standard authentication system.

My problem is that I am not quite sure on how to approach the problem of authentication from multiple locations. As there is only one random string for each user, he will be logged out from one location if he logs in from another.

The only solution I can come up with is a table in which the multiple logins of the user are stored, each with a separate random string in it.

Is this the right way to go? What happens with the unused sessions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:31:01+00:00Added an answer on June 14, 2026 at 8:31 pm

    If you want to support multiple locations, you can’t keep the cookie values in your user table. Rather you should create a new autologins table, using the cookie values and user id as the primary and foreign key respectively. I believe that was your idea as well.

    Then, for housekeeping purposes, you can record the last time any value was last used to login. Anything over XX days gets removed and the user need to sign in again. You can either set up a cron job for that or have it run every time someone signs in with a cookie.

    A cron removal job can process more records (because nobody is waiting for it to complete), but for optimization you need an index on the date field (to prevent a table scan).

    Housekeeping at every login has the advantage that you only have to query the cookie values for that user and thanks to the foreign key constraint the lookup is fast. But you can only clean up the current user’s cookies, so you may collect cookies that are never used again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a login system using PHP, and I'm not quite sure
Im trying to create a iPhone Objective C login page using PHP/MySQL to authenticate.
I'm trying to create a nested comment system using PHP and MySQL. But I'm
I am trying create system in which I can login from php and then
Ok so I am trying create a login script, here I am using PHP5
I am new to zend. I am trying to create login form using zend
I am trying to create a login screen for an iphone application using sqlite3
I'm a beginner in php, and I am trying to create a login and
I'm trying to implement basic auditing for a system where users can login, change
I'm trying to create a simple login system that will have the forms and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.