Solved

how to automatically logout when close the browser in php?

Posted on 2014-11-27
3
210 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
3 Comments
 
LVL 35

Accepted Solution

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

Assisted Solution

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
This video teaches users how to migrate an existing Wordpress website to a new domain.
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.

932 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now