-1

I wonder if it possible to force logout users session when Browser closes or Computer went sleep or hibernated?

any ideas?

Thanks

  • `ini_set( "session.cookie_lifetime", "0" );` can be used for keep session alive until browser is closed. – karthikr Jun 04 '13 at 20:05
  • The session will usually be destroyed when the browser closes (cookies won't as was already said), [this](http://stackoverflow.com/questions/4079115/can-any-desktop-browsers-detect-when-the-computer-resumes-from-sleep) should help for hibernate/sleep – kero Jun 04 '13 at 21:39

1 Answers1

0

Not until computer goes to sleep or hibernated, this are actions that happen outside of browser knowledge. You can log users out when the browser closes by checking the user authentification based on a cookie. In PHP and implicitly in Kohana this is done by setting the cookie expire parameter to 0. If set to 0, or omitted, the cookie will expire at the end of the session (when the browser closes).

Elzo Valugi
  • 27,240
  • 15
  • 95
  • 114