tags:

views:

58

answers:

1

Over SSL. Works in Chrome/Firefox but shows an empty value for sessionTestVariable for Opera/Safari/IE:

<? // https://mydomain.com/setSession.php
session_cache_limiter( 'nocache' );
session_set_cookie_params("899", "/", ".mydomain.com");
session_start();
unset($_SESSION['sessionTestVariable']);

// Set sessionTestVariable
$_SESSION['sessionTestVariable'] = "some string";
header("Cache-Control: no-cache, must-revalidate, post-check=3600, pre-check=3600"); // CacheBusting
header("Location: http://mydomain2.com/testSession.php");
exit; // this *should* fix the problem but does not
?>

////////////

<? // http://mydomain2.com/testSession.php
echo "Testing to see if we can trigger the session from mydomain.com";
echo "<script type=\"text/javascript\" src=\"https://mydomain.com/triggerCookie.php\"&gt;";
?>

////////////

<? // https://mydomain.com/triggerCookie.php
session_cache_limiter( 'nocache' );
session_set_cookie_params("899", "/", ".mydomain.com");
session_start();

// Set sessionTestVariable
echo "alert('session: " . $_SESSION['sessionTestVariable'] . "');";
session_destroy();
?>
A: 

I was able to solve this problem. The answer lies in a protocol called P3P.

I added

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');

right before

session_start()

Works!