Hi,
I have some trouble with sessions. I wrote a
login-srcipt based on sessions. It works fine. But now
I want that after ten minutes of inactivity the users
are automatically logged out. But I don't know how to
realize it. I am using PHP 5.
Can someone help me?
Thanks in advance,
Vinoth
Automatically Session expires
Moderator: General Moderators
Logged out... or to have the session expire?
To have the session expire, set the session.gc_max_lifetime in your php.ini file to 600 seconds (10 minutes). You can also be able to do this with ini_set().
If you want to do it with the code, you could store the time() in the session on each page load and compare it to the current time() on a subsequent page load.
To have the session expire, set the session.gc_max_lifetime in your php.ini file to 600 seconds (10 minutes). You can also be able to do this with ini_set().
If you want to do it with the code, you could store the time() in the session on each page load and compare it to the current time() on a subsequent page load.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
The time() based method places the management responsibility in your code. Specifically, you store a timestamp in their session data. You check this timestamp against the current timestamp.. If your logic considers it expired, then your code would delete the session data and log out the user bringing them back to a default, browsing state.
Re: Automatically Session expires
Sorry For late reply.
I check the time stamps for 1 hour but anyway the session expires after 14 minutes.
Is any possible way to prevent the session expires after 14 minutes or untill we close the browser.
I check the time stamps for 1 hour but anyway the session expires after 14 minutes.
Is any possible way to prevent the session expires after 14 minutes or untill we close the browser.