Re: Making coockies valid for multiple domains possible?
| From: | Jake McHenry | Date: | Mon, 12 Jan 2004 09:20:31 +0000 |
| Subject: | Re: Making coockies valid for multiple domains possible? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174294@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Merlin" <news.groups@web.de>
To: <php-general@lists.php.net>
Sent: Monday, January 12, 2004 3:56 AM
Subject: [PHP] Making coockies valid for multiple domains possible?
> Hello everybody,
>
> I am working on translating my site into multiple languages (i18n). Each
> different language is hosted on the same server, but on a different
> subdomain.
>
> example:
> de.server.com - german
> en.server.com - english
>
> Here comes the problem. Sessions are validated through coockies on my
> site. The system checks if the coockie is valid and compares it with a
> sessionid inside the database.
>
> It seems to me that coockies are only valid for one domain for security
> reasons.
>
> QUESTION:
> Is there a way to make that coockie valid for multiple domains?
>
> Thank you for any help on that.
>
> Regards,
>
> Merlin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
I've read the pages, it doesn't give very good examples from what I've seen,
but here is the page:
http://us2.php.net/manual/en/ref.session.php#ini.session.cookie-domain
Someone correct me if I'm wrong, but if you set this in your php.ini or with
session_set_cookie_params() to server.com, it's valid across any sub
domains, whereas if you set it to de.server.com, it would only be valid in
the de.server.com sub domain.
Or possibly try *server.com. I havn't played with this, since I only use
cookies when I manually set them, not for sessions.
Hope this helps,
Jake