PDA

View Full Version : Multiple domain affect whole site


xmeltrut
06-05-2005, 10:00 PM
Situation: you have forums.example1.com and boards.example2.com. You want cookies to work on both of them so that it remembers users but you want to set the cookie domain so that it affects all of example1.com or example2.com whichever the user is on.

The problem is that if you set the cookie domain in the admin panel, it will always use that domain even if you are using a second domain that is set-up to work with the forum also.

This quick mod will solve the problem and set the cookie to the full domain so no matter domain you are using it will set the cookie for the whole site (doesn't work with multiple sub-domains such as x.y.example.com yet).

I tested it with vB 3.0.7 but I checked the code for one of my older boards and I am pretty sure it will work fine with 3.0.3 and everything in between.

nexialys
06-06-2005, 10:12 AM
hum... this is not to share the users db, so there is no problem with the license...

btw, take care, this is only for boards where users have the same login/pass on both sides...

also take care:An owned license grants you the right to run vBulletin on one web server and one web site for each license purchased for an unlimited time. Each license may power one instance of vBulletin on one domain.

CompuJonathan
06-08-2005, 12:53 AM
Thanks for releasing this.

We have two VBulletin licenses and had a hard time getting the cookies to work. But somehow VB support got it going. :ninja:

We will use this when we rebuild the forums in 3.5 :squareeyed:

jb605
07-05-2005, 03:01 PM
It might also be helpful to add IP based cookie:



if (preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/',$_SERVER["HTTP_HOST"]))
{
// this is a ip address
$vboptions['cookiedomain'] = "." . $_SERVER["HTTP_HOST"];
}


Or something similar