Reply to Re: sessions and subdomains

Your name:

Reply:


Posted by shimmyshack on 05/11/07 11:48

On 11 May, 04:55, Kentor <ken...@gmail.com> wrote:
> Hello,
>
> I'm having trouble to setup one session that will work for subdomains
> and the main domain... I've read a lot about using various ways like
> init_set() or set.cookie_domain or using .htaccess and some others I
> can't remember... Everyone posting examples on the net are people who
> are having trouble with this session subdomain thing and I've tried
> some solutions but they don't seem to work. Please suggest something
> without having to access php.ini... and the same problem goes for
> cookies... but I guess if I can figure out sessions then cookies will
> be ok.. thanks
>
> Simon


$expiry = time()+900;
$path = '/';
$domain = server.com
session_start();
setcookie(session_name(),session_id(), $expiry, $path,$domain);

this way you are in control of what domain is used for the cookie
which in turn is used to send the session identifier, if you use the
more restrictive subdomain (as michael said) then the session id
cannot be accessed from the other sub domains on your server, unless
you take steps to write your own session-data-pass-along code, but the
above is easier huh!

[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

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