473,796 Members | 2,599 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 1989
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
1870
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 the member logs out. However when members are using Internet Explorer browser (most
3
14906
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
23340
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
8739
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 ----------------------------- namespace Sockets { #region Class - SocketClient
21
3073
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. Here's the bizarre thing: All computers are logged off, then I log into my web site with one...
5
3618
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
1950
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
2957
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
1443
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
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10217
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9047
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
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.