473,574 Members | 2,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

$_SESSION remains when browser is closed

Hi

I did not notice. A system I have made, seems on one server to keep
the $_SESSION even when the browser has been closed...
How can I avoid that?

WBR
Sonnich
Sep 2 '08 #1
12 1975
On 2 Sep, 14:44, jodleren <sonn...@hot.ee wrote:
Hi

I did not notice. A system I have made, seems on one server to keep
the $_SESSION even when the browser has been closed...
How can I avoid that?

WBR
Sonnich
How are you seeing this?
Sep 2 '08 #2
Hi
>
I did not notice. A system I have made, seems on one server to keep
the $_SESSION even when the browser has been closed...
How can I avoid that?

WBR
Sonnich
Kill it yourself when everything is done. session_destroy () look it up
Sep 2 '08 #3
On Sep 2, 5:41*pm, "Twayne" <nob...@devnull .spamcop.netwro te:
Hi
I did not notice. A system I have made, seems on one server to keep
the $_SESSION even when the browser has been closed...
How can I avoid that?
WBR
Sonnich

Kill it yourself when everything is done. *session_destro y() *look itup
How do I do that? I mean, I can close the browser, I dont get to know
it. When the open a browser again, then I get the old session without
knowing what has happened en between.

/S
Sep 2 '08 #4
On Sep 2, 6:07*pm, jodleren <sonn...@hot.ee wrote:
On Sep 2, 5:41*pm, "Twayne" <nob...@devnull .spamcop.netwro te:
I did not notice. A system I have made, seems on one server to keep
the $_SESSION even when the browser has been closed...
How can I avoid that?
Kill it yourself when everything is done. *session_destro y() *look it up

How do I do that? I mean, I can close the browser, I dont get to know
it. When the open a browser again, then I get the old session without
knowing what has happened en between.
I found session_cache_e xpire(30);
That may do it. Testing...
Sep 2 '08 #5
..oO(jodleren)
>I did not notice. A system I have made, seems on one server to keep
the $_SESSION even when the browser has been closed...
How can I avoid that?
If you use URLs to pass the session ID from one page to another, then
this is normal and expected behaviour. The server can't determine when
you close the browser, so the session will still live until it times
out. If you open another browser and paste the same URL with the session
ID into its address bar, you can continue the session.

Situation is different with a session cookie, which is the preferred
way. If you close the browser, the cookie will be removed as well. The
session will still be considered active on the server, but the browser
lost the connection to it and can't access it anymore.

Micha
Sep 2 '08 #6
jodleren wrote:
Hi

I did not notice. A system I have made, seems on one server to keep
the $_SESSION even when the browser has been closed...
How can I avoid that?

WBR
Sonnich
You can't. PHP handles sessions via cookies. The browser may clear
cookies when it closes, or it may not. If not, you have no way of
determining whether the browser was closed or not.

Setting an expiration time helps. But it still doesn't stop someone
form closing the browser and reopening it before the session expires.

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

Sep 2 '08 #7
Michael Fesser wrote:
.oO(jodleren)
>I did not notice. A system I have made, seems on one server to keep
the $_SESSION even when the browser has been closed...
How can I avoid that?

If you use URLs to pass the session ID from one page to another, then
this is normal and expected behaviour. The server can't determine when
you close the browser, so the session will still live until it times
out. If you open another browser and paste the same URL with the session
ID into its address bar, you can continue the session.

Situation is different with a session cookie, which is the preferred
way. If you close the browser, the cookie will be removed as well. The
session will still be considered active on the server, but the browser
lost the connection to it and can't access it anymore.

Micha
Micha,

With some browsers (Firefox for instance), it is an option to remove the
cookie or not. And if you don't remove the cookies, the session will
still be alive when you go back to the site (unless, of course, the
session has expired).

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

Sep 2 '08 #8
..oO(Jerry Stuckle)
>Michael Fesser wrote:
>.oO(jodleren )
>>I did not notice. A system I have made, seems on one server to keep
the $_SESSION even when the browser has been closed...
How can I avoid that?

If you use URLs to pass the session ID from one page to another, then
this is normal and expected behaviour. The server can't determine when
you close the browser, so the session will still live until it times
out. If you open another browser and paste the same URL with the session
ID into its address bar, you can continue the session.

Situation is different with a session cookie, which is the preferred
way. If you close the browser, the cookie will be removed as well. The
session will still be considered active on the server, but the browser
lost the connection to it and can't access it anymore.

Micha

Micha,

With some browsers (Firefox for instance), it is an option to remove the
cookie or not.
OK, that could be an issue (never encountered it, though, my primary
browser is Opera).
>And if you don't remove the cookies, the session will
still be alive when you go back to the site (unless, of course, the
session has expired).
Yep.

Micha
Sep 2 '08 #9
On Sep 2, 10:01*pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
jodleren wrote:
Hi
I did not notice. A system I have made, seems on one server to keep
the $_SESSION even when the browser has been closed...
How can I avoid that?
WBR
Sonnich

You can't. *PHP handles sessions via cookies. *The browser may clear
cookies when it closes, or it may not. *If not, you have no way of
determining whether the browser was closed or not.

Setting an expiration time helps. *But it still doesn't stop someone
form closing the browser and reopening it before the session expires.
I tried - 30 minutes seems like 30 days. It can even remember it
overnight
Sep 4 '08 #10

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

Similar topics

0
1865
by: Taz | last post by:
comp.lang.php, I have recently launched the new Planet-Tolkien.com, one would think that writing a message board from scratch and a dynamic weather system, a simple session login would be the least of my problems right? Wrong. It would appear that for Mozilla and Opera keep a $_SESSION is not an issue and the $_SESSION is continued until...
3
14900
by: Phil Powell | last post by:
PHP: unset($_SESSION); In my original environment (PHP 4.3.2) this line will delete the session variable 'mainDisplay'. But in the testing environment (PHP 4.3.6) the variable persists even after unset() is called. Is there some special setting in PHP that can allow a session to
13
23293
by: Mimi | last post by:
Hello, I am having trouble using the session vars in PHP 4.3.9 OS: Win XP Prof Web Server IIS (is local and there are no links to other servers from the web pages I work on) Browser: IE 6.0 The problem I am having is that each time I reload the same PHP page, I get
4
8713
by: DreJoh | last post by:
I've read many articles on the subject and the majority of them give the same solution that's in article 821625 on the MSDN website. I'm using the following code and when a the client disconnects the child socket remains in the CLOSE_WAIT state. Anyone have any idea what's missing? ----------------------------- Socket Code...
21
3045
by: axlq | last post by:
Someone please tell me if I've discovered a PHP bug. I'm sitting in front of several computers on my home network, behind a NAT firewall/router. I am testing my web site on these different computers (running different browsers, logged in as different users, etc.). My web site keeps track of users logged in through the use of $_SESSION. ...
5
3609
by: damezumari | last post by:
When a user logs in to my site http://iwantyourquestion.com I set $_SESSION to true if his username and password are OK. When he calls a page I check if $_SESSION is true. If it not I ask him to log in. Every page has at the start: session_start(); ob_start();
1
1943
by: helraizer1 | last post by:
Hi all, On my current project MyChatbox I have a box for which the user enters a name and the value of which is: Name: <input type="textbox" name="username" onkeyup="countdown(username, 10, used)" maxlength="10" size="10" value="<?php echo $_SESSION; ?>" />
3
2947
by: Gouri.Mahajan7 | last post by:
Hello, I am new to asp.net. Can anybody please tell me which event is fired when we close the browser. I want to remove some resources when the browser close button is pressed. Thanks in advance. Regards, Gouri.
4
1430
by: jodleren | last post by:
Hi! // get user to edit if( ($_POST=="btn_selusr")||($_POST!="") ) { echo "x:".$_SESSION; $username=stripslashes($_POST); echo "y:".$_SESSION; }
0
7736
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8249
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8107
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6464
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5631
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5307
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3748
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3756
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2252
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 we have to send another system

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.