Page 1 of 1

Trouble with COOKIES

Posted: Thu Feb 05, 2004 3:41 pm
by pickle
Hi all,

I'm having a little trouble with making a COOKIE be applicable over multiple directories. Essentially what I've got is a custom session-making script that relies on cookie data. I need to use that cookie to authenticate over multiple directories. The are all in the same main webapp folder, such that

Main_webapp_folder
|
---> Webapp_one
|
---> Webapp_two

I need to be able to have a cookie set in Webapp_one stay alive for Webapp_two.

When making the cookie, I have tried setting the path for the cookie to "../" and "../../webapp", as well as setting the domain to ".mydomain.com". None of this seems to be working though. BTW - I'm on a Linux server. Thanks folks.

UPDATE: Here's the exact call I'm using (except the domain of course)

Code: Select all

setcookie("sid",$cookieInfo,(SESSION_TIMEOUT * 60),"/",".mydomain.com");
//SESSION_TIMEOUT is a global variable set to 20
UPDATE 2:

I think I may have narrowed down the problem. Here are two setcookie calls:

Code: Select all

setcookie("sid",$cookieInfo,(SESSION_TIMEOUT * 60),"/",".mydomain.com");
setcookie("sid",$cookieInfo);
The first one fails, the second one works. WHAT THE HELL IS GOING ON!!!

(Needless to say this is starting to get irksome.)