MyBB Community Forums

Full Version: Cookie Issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello, I was hoping to get a little help with a problem I am having. I've seemed to mess up something with my cookies. I'm using the MyBB login system on both my site, forums, and cms. I can't for the life of me get the cookies to be detected on my website, forums, and cms.

website: example.com
forum: example.com/forums/
cms: example.com/cms/

my cookie settings are:
Cookie Domain: .example.com
Cookie Path: /
Cookie Prefix:
Board URL: example.com/forums

If I visit example.com/forums/ and login it works, but then I visit example.com or example.com/cms/ and it doesn't work.

I also include at the top of each page on example.com and example.com/cms:
chdir('forums');
define('IN_MYBB', NULL);
require_once '/public_html/forums/global.php';

I've tried clearing the cache of my browser, I've tried using multiple browsers, I've tried to set the settings from both the browser... editing settings.php and directly editing the database settings table. I can't for the life of me get this to work. I had it working fine not to long ago but I lost that code and had to start fresh. If I've left out any information that would be useful in helping me please let me know and I'll do my best to supply it. End result for me would be having the cookies detected across example.com, example.com/forums/, and example.com/cms/. If anyone could help I would very much appreciate it. Thanks in advance!
(08-03-2018, 06:33 AM)Born2Doubleup Wrote: [ -> ]Hello, I was hoping to get a little help with a problem I am having. I've seemed to mess up something with my cookies. I'm using the MyBB login system on both my site, forums, and cms. I can't for the life of me get the cookies to be detected on my website, forums, and cms.

website: example.com
forum: example.com/forums/
cms: example.com/cms/

my cookie settings are:
Cookie Domain: .example.com
Cookie Path: /
Cookie Prefix:
Board URL: example.com/forums

If I visit example.com/forums/ and login it works, but then I visit example.com or example.com/cms/ and it doesn't work.

I also include at the top of each page on example.com and example.com/forums:
chdir('forums');
define('IN_MYBB', NULL);
require_once '/public_html/forums/global.php';

I've tried clearing the cache of my browser, I've tried using multiple browsers, I've tried to set the settings from both the browser... editing settings.php and directly editing the database settings table. I can't for the life of me get this to work. I had it working fine not to long ago but I lost that code and had to start fresh. If I've left out any information that would be useful in helping me please let me know and I'll do my best to supply it. End result for me would be having the cookies detected across example.com, example.com/forums/, and example.com/cms/. If anyone could help I would very much appreciate it. Thanks in advance!

I am assuming that you have your settings set up like the way I have it in this screenshot.

However, I am wondering about the last 2 settings down at the bottom of the screenshot. 

How do you have those on yours?

As you have read, the settings.php MUST match what you have done in the AdminCP → Board Settings → Site Details
If you have either place off by a tiny bit... then you will have login issues.

Input /forums/ in the Cookie Path line. Thanks to @Ashely1 for correcting me on this. 

Try that and report back to us.

[Image: 30b7ec359833089093d54c8c448bec63.png]
Your cookie path should be /forums/

See this:
https://docs.mybb.com/1.8/development/cookies/
SameSite Cookie Flag does not exists on my install of mybb, but Secure Cookie Flag is set to No. I'm running version 1.8.15.

(08-03-2018, 09:56 AM)Ashley1 Wrote: [ -> ]Your cookie path should be /forums/

See this:
https://docs.mybb.com/1.8/development/cookies/

I've tried that. I've logged into my admincp, and then visited my forum index and I have to relogin. I tried to clear the cache from my browser and logged in and out a couple times.
(08-03-2018, 01:26 PM)Born2Doubleup Wrote: [ -> ]SameSite Cookie Flag does not exists on my install of mybb, but Secure Cookie Flag is set to No. I'm running version 1.8.15.

It would be a very wise idea to upgrade to 1.8.17. 

You must use the FULL upgrade package, not the incremental package.

I think you may see that Secure Cookie Flag option come up after the full upgrade.
(08-03-2018, 01:31 PM)Serpius Wrote: [ -> ]
(08-03-2018, 01:26 PM)Born2Doubleup Wrote: [ -> ]SameSite Cookie Flag does not exists on my install of mybb, but Secure Cookie Flag is set to No. I'm running version 1.8.15.

It would be a very wise idea to upgrade to 1.8.17. 

You must use the FULL upgrade package, not the incremental package.

I think you may see that Secure Cookie Flag option come up after the full upgrade.
 
That has nothing to do with my problem though? Upgrading will come, just have to work out a couple things first. Just trying to get this cookie situation under control. What can I do to figure out what the problem is? I've been searching google the last couple days with no luck. if I have that setting set to "/forums/" does that mean the cookies should still work for a directory outside the forums folder? I basically want the mybb cookies to work across my entire domain.
What version of php are you running ?
If your cookie domain and path is correct, the only other setting you can make is to set a prefix, and that only seems necessary as far as i know when you have multiple MyBB's running on the same domain.
I'm running version 5.6.30 of PHP. I'm only running one copy of MyBB. As I said I did have it working in the past, but I've had to rewrite some stuff and can't seem to duplicate what I did before. After I change the option from "/" to "/forums/" all I have to do is logout, clear my internet cache, login, and it should working across my entire site?
When did you upgrade to version 1.8.17 ? and was everything working up to that point ?

Like i said in another thread, i don't know what the minimum php requirement is for mybb now, but I suspect it is php 7.
It's literally a fresh installation of MyBB 1.8.15. I haven't upgraded to 1.8.17 and don't plan to upgrade like I said until I have this working right. Upgrading the forums has nothing to do with my problem. Like I stated before I had this working fine, just not sure why it isn't working anymore.

Just a quick follow up. I figured out what was wrong. I had to set it to "/" not "/forums/". Now the cookies work across my entire site again. Thanks.
Pages: 1 2