473,503 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ 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 13855
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
18450
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
19059
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
4028
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
2848
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
2402
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
2659
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
3203
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
1806
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
6768
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
7204
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
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7342
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6998
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
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1516
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 ...
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.