Solved

how to automatically logout when close the browser in php?

Posted on 2014-11-27
3
217 Views
Last Modified: 2014-12-11
This was already asked but the answer was incorrect.   I had always assumed that when the browser is closed and the client computer is turned off that the session will not persist.   This is not true.   I know because I've experienced it.   I turned off my computer and when I come back the session variable is still set.   Not only was my browser closed and my PC turned off but Apache which was running on my computer was turned off also.   What I've found is that if I close firefox without closing the tab that was open that the variable stays set.  If I close the tab first and then close the variable it is unset.    I can't find a solution or even an acknowledgement that this is an issue.     I hear tales that you can have the session variables drop after some period of inactivity however I'm not sure how to get the timer to start once inactivity has set in.
0
Comment
Question by:vrosas_03
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 36

Accepted Solution

by:
Kimputer earned 250 total points
ID: 40468939
What is your current session.gc_maxlifetime setting in php.ini?
0
 
LVL 55

Assisted Solution

by:Huseyin KAHRAMAN
Huseyin KAHRAMAN earned 250 total points
ID: 40469019
use meta no-cache...

when browser is closed, crashes, pc shuts down, session will not expire immediately, but will do after timeout (default is 15-20 min)

you can try turning off page cashing or try using some cookies...
0
 

Author Closing Comment

by:vrosas_03
ID: 40494633
This is the maxlifetime:
session.gc_maxlifetime = 1440
I thought it would close the session with the browser.  I ended adding something to check if there has been any activity and if there hasn't to log the user out.
0

Featured Post

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Introduction ( All good things must come to an end ) The original MySQL API has gone away.  It was deprecated (years ago) by PHP in Version 5.5, and removed from PHP in all current releases .  As a result, the issue is upon us today.  It's time to …
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question