Page 1 of 1

Sessions and IE6

Posted: Mon Nov 04, 2002 8:25 am
by sweahe
What has Microsoft done with the service pack 1 for IE6, after installing SP1 it doesn't accept cookies, my sessions does not work any more!?

What is the solution to this?

This simple little test doesn't work any more!

Code: Select all

<?php
GLOBAL $HTTP_SESSION_VARS;

session_start();
session_register('AVAR');
$HTTP_SESSION_VARS&#1111;'AVAR'] += 1;

echo $HTTP_SESSION_VARS&#1111;'AVAR'];

?>

Re: Sessions and IE6

Posted: Mon Nov 04, 2002 8:36 am
by seg
sweahe wrote:What has Microsoft done with the service pack 1 for IE6, after installing SP1 it doesn't accept cookies, my sessions does not work any more!?
IE6 has some new methods when dealing with cookies. Check your security settings. Under the new Privacy tab, you will find the new cookie settings.

-seg

Posted: Mon Nov 04, 2002 8:37 am
by twigletmac
One thing I noticed immediately that has nothing to do with IE 6: from the manual entry on session_register():
php manual wrote:If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered() and session_unregister().
This means that this need to be changed:

Code: Select all

GLOBAL $HTTP_SESSION_VARS;

session_start(); 
session_register('AVAR'); 
$HTTP_SESSION_VARS&#1111;'AVAR'] += 1; 

echo $HTTP_SESSION_VARS&#1111;'AVAR'];
Firstly session_start() should be at the very top of the page, secondly the rest should be (for PHP 4.1 and above):

Code: Select all

++$_SESSION&#1111;'AVAR'];
echo $_SESSION&#1111;'AVAR'];
or for PHP 4.0.6 or below (assuming that it's within a function otherwise you don't need the global statement):

Code: Select all

global $HTTP_SESSION_VARS;

++$HTTP_SESSION_VARS&#1111;'AVAR'];
echo $HTTP_SESSION_VARS&#1111;'AVAR'];
or

Code: Select all

++$AVAR;
session_register('AVAR');
echo $AVAR;
Mac

Posted: Tue Nov 05, 2002 1:42 am
by sweahe
There is nothing wrong with the script, it works perfectly in other browsers!
..anyway I did change the script to (no success):

Code: Select all

session_start();
++$_SESSION&#1111;'AVAR'];
echo $_SESSION&#1111;'AVAR'];
(and I have tried the settings too... I set it to accept everything, but it doesn't help!)

I tried to put
session_id('whatever');

in the script just before session_start();

Now the session works in IE too... but I can't have it like that, because then everyone will get the same session... and that's not good! =)
How do I set a session_id myself, that is some kind of random without having it change when hitting F5 (reload) ?

Posted: Wed Nov 06, 2002 3:47 pm
by sweahe
Not much to do about this it seems... the whole subject reads
"Bill was here!"

..again I'm afraid, it's an IE6 bug!
http://bugs.php.net/bug.php?id=15219