miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Master Class miniBB Support Forums / Master Class /  
 

cookies for multiple domains

 
Author deadpan
Partaker
#1 | Posted: 23 Aug 2005 05:50 
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
8-)
#2 | Posted: 23 Aug 2005 10:14 
Cookie and domain are the main tied things. It is impossible, if you have, for example, frenchdomain.com and englishdomain.com, to set cookie so it will work on both. But if you have, for example, french.somedomain.com and english.somedomain.com, then $cookiedomain='.somedomain.com'; and $cookiepath='/';

Author deadpan
Partaker
#3 | Posted: 25 Aug 2005 19:24 
I do have something like frenchdomain.com and englishdomain.com. 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
8-)
#4 | Posted: 25 Aug 2005 19:31 
Cookie works only on one domain, but it could work on different subdomains.

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

Author Team
8-)
#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
Partaker
#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 englishdomain.com can I call something like:
setcookie(..., "frenchdomain.com", ...)
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-)
#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 englishdomain.com, you can set cookie for frenchdomain.com. 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
Partaker
#9 | Posted: 31 Aug 2005 23:33 
ok. thanks.

Master Class miniBB Support Forums / Master Class /
 cookies for multiple domains
 Share Topic's Link

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


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑