Through SSL. Works in Chrome / Firefox, but shows an empty value for sessionTestVariable for Opera / Safari / IE:
<?
session_cache_limiter( 'nocache' );
session_set_cookie_params("899", "/", ".mydomain.com");
session_start();
unset($_SESSION['sessionTestVariable']);
$_SESSION['sessionTestVariable'] = "some string";
header("Cache-Control: no-cache, must-revalidate, post-check=3600, pre-check=3600");
header("Location: http://mydomain2.com/testSession.php");
exit;
?>
////////////
<?
echo "Testing to see if we can trigger the session from mydomain.com";
echo "<script type=\"text/javascript\" src=\"https://mydomain.com/triggerCookie.php\">";
?>
////////////
<?
session_cache_limiter( 'nocache' );
session_set_cookie_params("899", "/", ".mydomain.com");
session_start();
echo "alert('session: " . $_SESSION['sessionTestVariable'] . "');";
session_destroy();
?>
source
share