I'm writing a forum system and have 2 copies of the system running on a webserver. The 2nd copy (which is in a subdirectory) is having problems with the cookies.
Cookies are set like so:
setcookie("COOKIE_USER", $loginuser->getuser(), $time);
So it sets the user information in the cookie with an expiry time.
The 1st forum running in the root (http://www.server.com/index.php - as an example) works fine. Cookies aren't an issue. However, if it's running in a directory (http://www.server.com/directory/index.php) then cookies don't work at all.
I know that you can set extra parameters for the cookies:
setcookie("COOKIE_USER", $loginuser->getuser(), $time, dirname($PHP_SELF), $HTTP_HOST);
The above should limit the cookie to the server it's on and the directory & filename of where the system is located.
Any idea why this doesn't work?
Thanks.
James.