Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved [How To?] Cookies in another directory
#1
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?
#2
Not Solved
If I'm not mistaken cookies can be read by the whole domain.
#3
Not Solved
Here's what I use:

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

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.
#4
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.
#5
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.
#6
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 'rfbin.net' and that domain was set up by me on my VPS so that its virtual directory is resourceforums.net/rfbin which if you go there it would give you 'Resource Forums:1', but if you go to rfbin.net it wont because it's not the same cookie domain.

Any ideas?


Forum Jump:


Users browsing this thread: 1 Guest(s)