?
Solved

how to automatically logout when close the browser in php?

Posted on 2014-11-27
3
Medium Priority
?
231 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 1000 total points
ID: 40468939
What is your current session.gc_maxlifetime setting in php.ini?
0
 
LVL 57

Assisted Solution

by:HainKurt
HainKurt earned 1000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Foreword (May 2015) This web page has appeared at Google.  It's definitely worth considering! https://www.google.com/about/careers/students/guide-to-technical-development.html How to Know You are Making a Difference at EE In August, 2013, one …
Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
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.

770 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