sois wrote:can I just remove the path and domain parameters from the code? Won't that restrict the cookie to the /lvsl/ path only by default?
Yes. As per the manual for [man]setcookie[/man], "The default value is the current directory that the cookie is being set in."
scrupul0us wrote:I don't believe so, by default I believe cookies are tied to the domain and not sub folders
Cookies have both domain and path attributes, though.
sois wrote:Hmm, the problem actually is a Firefox issue. It saves the passwords for only domains and not paths under a domain. So it will save a cookie for lvsl.sois.com but not sois.com/lvsl/.
Not true, unless you're using some old/buggy version of Firefox. Using Firefox 3.0.6, the 'path' attribute worked as expected in my simple test case. The code I called was:
setcookie("user", "brad1", time()+3600);
in a "tcp" subdirectory and:
setcookie("user", "brad2", time()+3600);
in a "lvsl" subdirectory.
After setting cookies in one or both locations, a PHP script that echo'd out the cookie data sent revealed that only the correct data (e.g. "brad1" for the tcp folder) was outtputed, else nothing at all (since no cookie was sent for that path/domain combination).