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 8979991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:58:21+00:00 2026-06-15T19:58:21+00:00

Hello I’m trying to come up with a way to update my database if

  • 0

Hello I’m trying to come up with a way to update my database if the user does not logout properly. Utilizing the session.gc_maxlifetime seems to be the right way to do it. Is it possible to call a function when the lifetime has expired and the garbage collector destroys the session? Also how does the gc_maxlifetime reset its timer? Is it when some $_SESSION variable updates? or just a client request?

I’ve tried finding solutions but they all involve user interaction e.g I set a custom session timer and if the user interacts with the webpage after being inactive for too long the “logout” function kicks in and session in destroyed.

  • 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-15T19:58:22+00:00Added an answer on June 15, 2026 at 7:58 pm

    You can hook into session GC by writing your own session handler and applying it with session_set_save_handler(). The function given as the gc parameter will be called when it’s time to perform GC on sessions.

    Note that these functions only get access to the serialized session data, and that the serialization format that sessions use is subtly different than the normal PHP serialization method. If you’re trying to read user data during the GC process, you’re not going to have much fun doing so.

    Instead, you probably want to separately record user activity attached with a session ID, and track inactivity & lack of logouts as a separate mechanism.

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

Sidebar

Related Questions

hello friends i am trying to get a list of user id and want
Let's say I'm outputting a post title and in our database, it's Hello Y’all
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
Hello I have this problem with PyQt4-dev-tools that include: * a user interface compiler
Hello All I am trying to flatten a list in Ocaml. I am a
Hello i need to gater the data from db(MSSQL) in following way: <div id=slider>
Hello guys i have an website online wich access the database. The database access
Hello I'm making RSS reader and I'm using DOM. Now I stuck, trying to
Hello again; i need to show X,Y,Risk in ListBoxes. But i can not do
Hello I am trying to implement a wake lock for an application. PowerManager pm

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.