- Jan 18, 2002
- 5,893
- 0
- 76
I've never done much with cookies before now but I'm trying to use them in a redesign of one of my sites and I'm having a bit of trouble getting it to work correctly.
I have a login page that sets cookies called "username" and "password" and I'm using the "/" domain, basing that off the PHP manual for setcookie() saying that the cookie will be available across the entire domain. I originally wasn't setting the domain and the cookie was showing up as only available in the /new/ directory (which is the directory on my domain that I'm developing the site in), so I changed it to "/". At any rate, I set the cookie in a PHP file directly under the /new/ directory. The problem lies when I try to access that cookie from /new/anotherdirectory. Even though I set the domain to /, it's not getting the data from the cookie.
It's entirely possible that I'm making some stupid newbie error. I hope that's what it is, anyway. Any ideas why the cookie works just fine when the PHP file is directly under /new/, but not when it's under a subdirectory of /new/ ? Thanks for any help on this.
I have a login page that sets cookies called "username" and "password" and I'm using the "/" domain, basing that off the PHP manual for setcookie() saying that the cookie will be available across the entire domain. I originally wasn't setting the domain and the cookie was showing up as only available in the /new/ directory (which is the directory on my domain that I'm developing the site in), so I changed it to "/". At any rate, I set the cookie in a PHP file directly under the /new/ directory. The problem lies when I try to access that cookie from /new/anotherdirectory. Even though I set the domain to /, it's not getting the data from the cookie.
It's entirely possible that I'm making some stupid newbie error. I hope that's what it is, anyway. Any ideas why the cookie works just fine when the PHP file is directly under /new/, but not when it's under a subdirectory of /new/ ? Thanks for any help on this.