MyBB Community Forums

Full Version: .www in cookie domain
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Putting this in the 1.6 forum as it wouldn't be changed for 1.4 but it applies to both.

Sometimes the installer auto-sets cookie domain to include .www at the start. If it's like this you need www. in the URL when you view the forum, which obviously you wouldn't always have, and it causes problems; a cookie wouldn't be set if you visit with no www., hence you don't stay logged in. I can think of no reason for it to need this, so why not strip out .www from the start if it's there in the installer, and edit during runtime in a similar way to the bburl. ./inc/init.php:198:

if(substr($settings['bburl'], -1) == "/")
{
	$settings['bburl'] = my_substr($settings['bburl'], 0, -1);
}

add after:

if(substr($settings['cookiedomain'], 0, 5) == ".www.")
{
	$settings['cookiedomain'] = my_substr($settings['cookiedomain'], 0, 4);
}

Needs to have different lengths in the substr checks; needs to check .www. in the original value to make sure it's not a valid setting with a domain that starts with www, but then only needs to chop off the first 4 characters.

Please and thank you.
I'd throw this in as a bug report