473,472 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Session destroy when closing browser

Hi all,

After a visitor has loged in, a session is started.
The session is destroyed after the visitor clicked "Log out'.

When the visitor forgets to log out and closes the browser immediately, the
session stil exists because when the visitor opens the browser again and
comes back to the site he/she is still loged in.
Ofcourse i don't want that.
I want the session to be destroyed when the visitor closes the browser
immediately.

Is there a way to destroy a session when the user closes the browser and
forgets to log out.

If instead of php, javascript is necessary, please tell me also.

T.i.a.

Best regards,
Tino Wintershoven.
The Netherlands
Jun 2 '08 #1
3 13847
T. Wintershoven wrote:
Hi all,

After a visitor has loged in, a session is started.
The session is destroyed after the visitor clicked "Log out'.

When the visitor forgets to log out and closes the browser immediately, the
session stil exists because when the visitor opens the browser again and
comes back to the site he/she is still loged in.
Ofcourse i don't want that.
I want the session to be destroyed when the visitor closes the browser
immediately.

Is there a way to destroy a session when the user closes the browser and
forgets to log out.

If instead of php, javascript is necessary, please tell me also.

T.i.a.

Best regards,
Tino Wintershoven.
The Netherlands
In your php.ini file, set the value:

session.cookie_lifetime=0

Or, before EVERY session_start() call, use:

session_set_cookie_params(0);
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #2
Jerry Stuckle escribió:
>Is there a way to destroy a session when the user closes the browser
and forgets to log out.
[...]
In your php.ini file, set the value:

session.cookie_lifetime=0

Or, before EVERY session_start() call, use:

session_set_cookie_params(0);
Apart from this, note that session data still exists on server; it will
be deleted eventually, when next "garbage" collection happens. In
general, the server has no way to know that you've closed the browser.
Usually, that's not an issue*, just be aware of it.
(*) It's an issue when you're paranoid about hackers using someone
else's session ID
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Jun 2 '08 #3
Álvaro G. Vicario wrote:
Jerry Stuckle escribió:
>>Is there a way to destroy a session when the user closes the browser
and forgets to log out.
[...]
>In your php.ini file, set the value:

session.cookie_lifetime=0

Or, before EVERY session_start() call, use:

session_set_cookie_params(0);

Apart from this, note that session data still exists on server; it will
be deleted eventually, when next "garbage" collection happens. In
general, the server has no way to know that you've closed the browser.
Usually, that's not an issue*, just be aware of it.
(*) It's an issue when you're paranoid about hackers using someone
else's session ID

If you're that paranoid about hackers, you should be using https protocol.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Pete | last post by:
I have a site which is using sessions to pass data from one page through to the next. The problem that I have is that there are only two places where the session could/should be destroyed. This...
4
by: megha | last post by:
Hi I am writing a program in JSP which requires user to log in and as he logs in database was updated with his status on and till the user does not sign out no other user with same login and...
14
by: Darrin J Olson | last post by:
I am trying to end a session for a site without having to completely close the browser to end it. When I access the site and log in it works fine. If I log out and in with a different account...
4
by: Al | last post by:
Is possible to terminate all session variable created without closing the browser I do not want users to click on BACK button on browser or paste the url link in the http:// and shows the record...
2
by: Nate Spillson | last post by:
I have an asp.net web application that uses session variables to store user information (username, security areas, configuration data). When the user logs into the system I store all of this...
2
by: RC | last post by:
hi, I now got a session ID. I want to try to resume a session by closing the current browser and open a new one. Then pass the session ID in URL query string on new browser to resume the...
0
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te...
8
by: Mantorok | last post by:
Hi I've just been told that closing your browser closes your session on the web-site you are viewing, is this true? If so, is this the browser that initiates the closure, or the server? ...
3
by: Amar | last post by:
Hi all, I want to use a cookie that will destroy after closing the browser, in my application. I am able to destroy my cookie after log out,but don't know how to destroy this when I will ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.