[FX.php List] Strange session variable behavior
Bob Patin
bob at patin.com
Sun Apr 1 10:09:25 MDT 2007
Dan,
So my understanding of session variables has been wrong all this time
I guess...
I thought that if I set a session variable to "Y" for example, then
closed my browser, when I returned, this session variable would have
no value yet because I hadn't set it yet in this session.
From reading the article you referenced I still am not sure how to
ensure that a session ends when someone closes their browser. For
example, when I develop a cart, I have always used session variables,
and they've worked fine; when someone closes their browser, their
cart is emptied, no matter how many items were in it.
Why, in this current project, does my session variable persist? All
I've done is to set it in a previous visit...
To make it even stranger, I wrote a test page with this on it:
session_start();
session_destroy();
I went to that page, then went BACK to my other page to see the state
of my session, and I'm still being told that my session variable has
a value.
Is this something goofy in PHP? Should I restart my server?? :)
Bob
On Apr 1, 2007, at 10:51 AM, DC wrote:
> this:
>
> http://www.google.com/search?q=session+variable+browser+close+PHP
> +tutorial&btnG=Search&hl=en&safe=off
>
> resulted in this:
>
> http://devzone.zend.com/node/view/id/1312
>
> dan
>
>
> On Apr 1, 2007, at 11:44 AM, Bob Patin wrote:
>
>> I'm writing a site where I'm using a session variable to login
>> users and either allow or deny access to certain pages in the site.
>>
>> When I come back to the site, after closing my browser, my session
>> variables are still set; I thought that closing my browser killed
>> any session variables--isn't this the case?
>>
>> If so, then why doesn't my session variable get dumped when I
>> close my browser? For that matter, when I went to a 2nd browser
>> (Firefox), I was STILL able to retrieve the session variable...
>>
>> Correct me here if I'm wrong; should I not be able to close my
>> browser to close out any session?
>>
>> Thanks,
>>
>> Bob Patin
>> Longterm Solutions
>> bob at longtermsolutions.com
>> 615-333-6858
>> http://www.longtermsolutions.com
>>
>> CONTACT US VIA INSTANT MESSAGING:
>> AIM or iChat: longterm1954
>> Yahoo: longterm_solutions
>> MSN: tech at longtermsolutions.com
>> ICQ: 159333060
>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
More information about the FX.php_List
mailing list