473,804 Members | 3,063 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
12 1990
jodleren wrote:
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
Setting the session timeout correctly does work. How did you do it?

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

Sep 4 '08 #11
On Sep 4, 3:08*pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
jodleren wrote:
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

Setting the session timeout correctly does work. *How did you do it?
session_cache_e xpire(60); // minutes
session_set_coo kie_params(60*$ ini_value['timeout']); //
session.cookie_ lifetime

both does not work - it still remembers.

I cannot access the php.ini, the provider does not allow that - I have
to contact them (www.nss.ee) to have it done. They claim that
register_global s is now false, but I cannot see the effect.
Instead I am changing the code in some places. But this problem here
remains.

WBR
Sonnich
Sep 4 '08 #12
jodleren wrote:
On Sep 4, 3:08 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>jodleren wrote:
>>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
determinin g 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
Setting the session timeout correctly does work. How did you do it?

session_cache_e xpire(60); // minutes
session_set_coo kie_params(60*$ ini_value['timeout']); //
session.cookie_ lifetime

both does not work - it still remembers.

I cannot access the php.ini, the provider does not allow that - I have
to contact them (www.nss.ee) to have it done. They claim that
register_global s is now false, but I cannot see the effect.
Instead I am changing the code in some places. But this problem here
remains.

WBR
Sonnich
If you use them, both session_cache_e xpire() and
session_set_coo kie_params() must be called before EVERY session_start() .
Are you doing this?

And you can see the value of pretty much all of the settings in the
php.ini file with phpinfo().

And what's in $ini_value['timeout']?
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Sep 4 '08 #13

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
14907
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
23341
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
8742
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
3077
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
3619
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
2958
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
9711
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
9591
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10594
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
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
9166
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...
0
5529
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...
1
4306
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
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.