You are here: Re: [PHP] Session has new id on 'some' pages. « PHP « IT news, forums, messages
Re: [PHP] Session has new id on 'some' pages.

Posted by Edward Vermillion on 07/18/05 18:29

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация