Re: Session has new id on 'some' pages.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andy Pieters wrote:
Ok found the solution, seems like one page is on http://server.org.uk and the other on www.server.org.uk even though its the same server it generates a different session id!


That's a cookie thing, if your transmitting the session ids through cookies, I'm going to assume that trans sid will do the same thing. The deal is that when you go to server.org it's not going to have access to a cookie set on www.server.org. I've had this happen to me too. I set a variable like

$http_root = 'http://www.myserver.com/'

and then the links I generate have

$link = $http_root."newpage.php"

If the site is accessed at http://myserver.com then the links don't get the right cookie.

the best thing to do is to set

$http_root = 'http://'.$_SERVER['SERVER_NAME']

,or whatever you have available in $_SERVER, then the links are all set correctly. Or you can use relative paths like

$link = "index.php"

and the right cookie will be set/read.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux