Re: [PHP] (auto) session expire



On Mon, Jan 5, 2009 at 12:05 PM, Shiplu <shiplu.net@xxxxxxxxx> wrote:
This is a very common issue. I searched and found many sites talking
about this. but no good solution.
Well the problem is I want to set my session will expire after 10
minutes of inactivity. Just like an banking site.
When user is inactive for 10 minutes the session will expire. In fact
the browser will delete the cookie.
The browser will delete the cookie because it was told by the server.
I used these lines

Don't trust client-side actions.

Never.

session_cache_expire(APP_SESSION_TIMEOUT);
session_set_cookie_params(APP_SESSION_TIMEOUT*60);
ini_set("session.gc_maxlifetime", APP_SESSION_TIMEOUT * 60);
session_start();

It runs at the very beginning of my application. APP_SESSION_TIMEOUT
has value 10 which is in minutes.

The problem is it works good in FF3. But not in IE.

Any Idea how to resolve it? or any standard way to fix it?

I'm not sure if there is any "standard" way to fix it. What I do is
just compare current time with the last action time. If it's bigger
than my timeout, session_destroy().

If anyone has any other ideas, I'd like to hear it. :)

--
Blog: http://talk.cmyweb.net/
Follow me: http://twitter.com/shiplu

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Thiago Henrique Pojda
http://nerdnaweb.blogspot DOT com
.



Relevant Pages

  • Re: [PHP] (auto) session expire
    ... minutes of inactivity. ... When user is inactive for 10 minutes the session will expire. ... Set it to your timeout and the server will get rid of the session. ...
    (php.general)
  • Re: (auto) session expire
    ... minutes of inactivity. ... When user is inactive for 10 minutes the session will expire. ... for the request that triggered the garbage collection. ...
    (php.general)
  • Re: Destroying Objects
    ... >destructors for objects. ... >when a session is no longer needed, for example, when a user leaves the ... that a certain period of inactivity means they left the site. ... expire after 15 minutes of inactivity, then the "visitor left site" code ...
    (comp.lang.php)
  • Re: Timeout Problem after Switching a DAC unit with OSA in the z10
    ... CICPTOR is the CICS that owns the terminals. ... 06:35:53 TELNE875 Signon 7 minutes later the user is signing in again ... inactivity happens 30 min. later, ... which describes the behaviour of a TN3270E concatenation - SNA session to ...
    (bit.listserv.ibm-main)
  • Re: close session automatically
    ... When I say "the session of users ... when logon hours expire, the same thing happens as in the 1). ... This isn't a real logoff but a cutoff of SMB connections to file shares. ... logging the user off in a hard way isn't a good idea - when applications are open even more so. ...
    (microsoft.public.windows.group_policy)