Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved [How To?] Cookies in another directory
Not Solved
I have my forum located in the / directory and I'm making a file in the /app directory. I need to be able to grab the username of the user from the / directory.

Can someone help?
Not Solved
If I'm not mistaken cookies can be read by the whole domain.
Not Solved
Here's what I use:

chdir("../"); // path to MyBB
define("IN_MYBB", 1);

echo $mybb->settings['bbname'] . ':' . $mybb->user['uid'];

It returns: Resource Forums:0 which means my uid would have to be 0 and it's not.
Not Solved
MyBB sets cookies to the root path (assuming installation at the root). According to PHP's setcookie documentation, it works on all paths.

Quote:The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set in.

I can't help you with debugging that, sorry.
Not Solved
You need to set the cookie path to "/" in the ACP. Once you log back in, the username will be accessible to the other folder.
Lost interest, sold my sites, will browse here once in a while. It's been fun.
Not Solved
The cookie path is set to that. Could it be something with Google SEO and the htaccess?

I have found the problem, just not a solution. I have my forum, then I have another domain '' and that domain was set up by me on my VPS so that its virtual directory is which if you go there it would give you 'Resource Forums:1', but if you go to it wont because it's not the same cookie domain.

Any ideas?

Forum Jump:

Users browsing this thread: 1 Guest(s)