miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Master Class miniBB Support Forums / Master Class /   

cookies for multiple domains

Author deadpan
#1 | Posted: 23 Aug 2005 05:50 | Edited by: deadpan 
I'm using miniBB 1.7 (the server has an old version of php and there's nothing i can do about it).

my site is bilingual, and there are two different domains (one french, one english) that you can switch between. I've been hacking at the code to change a bunch of things about how logins work, but I'm stumped at how to get the login cookies to work for both domains at once.

I want to be able to login to the english site, then click to switch to french (bringing me to another domain), and still be logged in. The problem is that the cookiedomain is getting set as the domain I'm in when I login, and it isn't recognized from the other domain. I've tried setting two cookies (in index.php, etc., wherever cookies are set) with two different cookiedomains (set in setup_options.php), but still only the one cookie gets set.

any ideas as to why only one cookie is getting set? it is possible to set a cookie for a different domain, right?

Author Team
#2 | Posted: 23 Aug 2005 10:14 
Cookie and domain are the main tied things. It is impossible, if you have, for example, and, to set cookie so it will work on both. But if you have, for example, and, then $cookiedomain=''; and $cookiepath='/';

Author deadpan
#3 | Posted: 25 Aug 2005 19:24 | Edited by: deadpan 
I do have something like and so what i was trying to do was set 2 cookies, one for each domain. that should be possible, right?

maybe i have to set the cookiepath to something other than '/' for the second cookie?

Author Team
#4 | Posted: 25 Aug 2005 19:31 
Cookie works only on one domain, but it could work on different subdomains.

Author deadpan
#5 | Posted: 25 Aug 2005 20:09 
ya. i understand that. that's why i'm trying to use 2 cookies.

Author Team
#6 | Posted: 25 Aug 2005 20:26 
This is a fault - cookie from one server can not be read on another server.

Else the www would be hacked in the first day :)

Author deadpan
#7 | Posted: 29 Aug 2005 06:22 
i'm not sure if you're answering my question or not. maybe i'm just being dense, but it seems like you keep answering something that is not my question.

- i realize that a cookie can only be READ by a server matching the cookie's domain. this is exactly why i'm trying to set two cookies: one for each domain so that both domains have a cookie they can read.

- what i'm wondering about is whether it's possible to SET a cookie from a different domain.
on can I call something like:
setcookie(..., "", ...)
I'm doing that, but only one cookie is getting set.

i wonder what the purpose would be of having a $cookiedomain argument in setcookie if it's not possible to set it to something other than the domain the cookie comes from.

so my hunch is that it must be possible.

and instead of asking the same question 4 times in here, I would probably do better to try to fix it on my own by combing through the (unindented, uncommented, hell to figure out how to change, but all i've got to work with because of the insanely old version of php i'm stuck with) code for the problem.

Author Team
#8 | Posted: 29 Aug 2005 16:07 
Sorry, I did not completely understand your question then. Of course, you can try to set cookie's domain to different domain, like in your case - if you have, you can set cookie for But it won't work, for sure. Because server itself handles this setting automatically. In cookie function, in most cases (like miniBB's default), you can even have no value for domain at all. No, it is impossible and can not be possible, I've already explained why.

This setting is necessary for people having trouble with automatic cookie recognition, or need some advanced possibilities. And its purpose is for READING only, not writing.

Author deadpan
#9 | Posted: 31 Aug 2005 23:33 
ok. thanks.

Master Class miniBB Support Forums / Master Class / cookies for multiple domains Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

You are welcome to post anonymously, by entering a nickname with no password (if the similar Username has not been taken yet), or by leaving both fields empty. If you have a forums account, you can also sign in from this page without posting a message, or sign in and post at once.

Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB