Reply to Re: Sessions

Your name:

Reply:


Posted by Colin McKinnon on 01/22/07 21:48

Rik wrote:

> wombat wrote:
>>
>> Are sessions url dependent? If so, is there a work-around?
>
> Cookies are host dependant (with an optional path).
> home.*.com is not the same host as www.*.com
>
> Carrying on sessions between domains is therefor not possible by cookie.
> The only workaround is carrying over the session_id by a POST or GET
> variable, and it may be necessary to write your own session_handler,
> instead of the default one in PHP, so you can still collect previously set
> session-data. This is not recommended, but possible.

I'd be interested to know why this is not recommended. I'm happy to be
proved wrong but I can't see why this is more dangerous than sessions
within a single vhost.

There's no need to write your own session handler if you're moving between
virtual hosts on the same server - just include the session id in
links/forms to the receiving end, and (at the receiving end) :

....
if (!session_id() && ($_REQUEST['throw_session'])) {
session_id($_REQUEST['throw_session']);
}
session_start();

....

HTH

C.

[Back to original 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

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