Posted by nigel.t on 10/09/06 16:29
I have a page that contains just
<?php
session_start();
$_SESSION['test'] = 'HELLO';
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = '../listings/store.php';
header("Location: http://$host$uri/$extra");
exit;
?>
store.php would then start with:
<?php
session_start();
echo($_SESSION['test']);
// and so on
?>
The purpose of the page is just to do a re-direct but is needed.
The problem I have is this:
If a user comes to my site with: www.mysite.com and then visits
the above re-direct script/page all is well and the page store.php can do
echo($_SESSION['test']); and get HELLO out.
BUT
If the user comes to the site with just mysite.com
PHP sets TWO PHPSESSID cookies : one for mysite.com and another for
www.mysite.com
This causes the $_SESSION['test'] variable to be lost.
Hard coding the re-direct page can't cure this for me.
Can anyone shed any light or help me prevent the second PHPSESSID from
losing the variable please?
thanks.
nigel.
Navigation:
[Reply to this message]
|