Forum Moderators: coopster

Message Too Old, No Replies

Session Variables not persistent in IE6

         

blu3

9:54 pm on Sep 9, 2009 (gmt 0)

10+ Year Member



My case is very simple, but I've read through many posts and tried the suggestions but can't seem to figure this one out....

session's variables are not passed to the next page in IE6.
Every page refresh creates a new session_id().

I'm using wamp/IE6, no software blocking cookies, and the privacy setting is set to Medium... I know i can pass the PHPSESSID to the next page, but security issues would not allow this method.

This code works is an example of what I'm trying to do, it works fine in Firefox... here are the basics:

t1.php


<?php
session_start();
error_reporting(E_ALL);
ini_set("display_errors", -1);


$mysession = session_id();
print_r($mysession);


print "<br>";
$_SESSION['test']="test";
print "<a href='t2.php'>t2</a>";
print "<br>";


$_SESSION['firstname'] = 'charlie';
print_r($_SESSION['firstname']);
print "<br>";
?>

The output for t1.php i.e.

ing0t5cn53kfa2ptb6l8duppa6
t2
charlie

t2.php


<?php
session_start();
$mysession = session_id();
print_r($mysession);


print "<br>";
print_r($_SESSION);


print "<br>";
print_r($_SESSION['test']);


print "<br>";
print_r($_SESSION['firstname']);
?>

the output for t2.php i.e.

bh9ueqb61gk3mriq5f3bem4jj1
Array ( )
Notice: Undefined index: test in C:\wamp\www\test\t2.php on line 12
Notice: Undefined index: firstname in C:\wamp\www\test\t2.php on line 16

IE6 creates a new session_id in the next page, so the session variables are tagged with undefined index...

This is my first time posting here... how can this be solved?

omoutop

7:28 am on Sep 10, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you have $mysession = session_id(); in both pages which creates a ew instance in both pages

in your first page try: $_SESSION['mysession']=session_id();
and in your second page: print_r($_SESSION['mysession']);
(and you delete the $mysession = session_id(); in both pages)

try and play with this and see how its going

and welcome to webmasterworld

blu3

5:16 pm on Sep 10, 2009 (gmt 0)

10+ Year Member



Thanks... I'll try that and let you know.