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

  • SEARCH
  • Home
  • 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 1094341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:57:35+00:00 2026-05-16T23:57:35+00:00

I currently use PHP sessions as the basis of my user login system, with

  • 0

I currently use PHP sessions as the basis of my user login system, with a successful login setting $_SESSION[‘userid’]. This allows a user to log in to the same account from multiple machines.

However, I’d like to implement the following features:

  1. Log out everywhere, similar to what Stack Overflow has.
  2. See where else one is logged in.

Both will likely require more than just a session variable, and I’m willing to put more information into the database to accomplish these. What is a standard way to do the above?

  • 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-05-16T23:57:35+00:00Added an answer on May 16, 2026 at 11:57 pm

    Create a new database table to store sessions, and then instead of storing information directly in $_SESSION, just store an ID referring to a row in your new session table. This table can contain information like IP address, username, and the time of last activity.

    Your application should check the sessions table against what it has in $_SESSION, so when you remove all rows in the table for a particular user, every session will be invalidated, wherever it is. You can also query for all rows belonging to a particular user, so you can show where they have active sessions.

    You’ll have to start thinking about handling where a user leaves their session without explicitly logging out – possibly a scheduled job that runs every hour or day, clearing out session rows that haven’t had any activity in a certain period of time.

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

Sidebar

Related Questions

I currently use, base64_encode() to encode a user's password, this works well because it
I have site for example www.mysite.com, with a simple login system. I use PHP
I am currently using various back-end services and I want to use PHP to
I currently use a System.IO.FileSystemWatcher as part of a roll your own message queue
I currently have a website that allows my visitors to login via a simple
I want to create a simple affiliate code. Currently I use PHP session to
I'm currently trying to use the current session of a php web page from
I use a user management script with Sessions the session object $loggedInUser contains these
I have a question about PHP sessions. I use a session to keep a
I'm currently setting up an authentication system. My current layout is to get his

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.