|
|
|
|
|
|
| Author |
Message |
John Drako *nix forums beginner
Joined: 16 Feb 2005
Posts: 7
|
Posted: Thu Jul 20, 2006 7:32 pm Post subject:
How to set a session cookie with a path?
|
|
|
I need to set a session cookie (expires when the browser closes) with a
path of "/".
Is there a way to do it?
I tried:
setcookie("cookie_name", $cookie_value, "", "/");
and
setcookie("cookie_name", $cookie_value, "0", "/");
and of course none of them worked.
I can't move the page that is setting the cookie to the top level
directory of the site, but I need the cookie to be available to couple
of page there.
Is this doable at all?
TIA |
|
| Back to top |
|
 |
Janwillem Borleffs *nix forums Guru
Joined: 20 Feb 2005
Posts: 404
|
Posted: Thu Jul 20, 2006 8:29 pm Post subject:
Re: How to set a session cookie with a path?
|
|
|
John Drako wrote:
| Quote: | I tried:
setcookie("cookie_name", $cookie_value, "", "/");
and
setcookie("cookie_name", $cookie_value, "0", "/");
and of course none of them worked.
|
The manual says:
"Because the expire argument is integer, it cannot be skipped with an empty
string, use a zero (0) instead"
So, do not use "0" but 0.
When working between subdomains of the same father domain, you should also
supply the fifth argument with a value of ".yourdomain.com" (mind the
preceding dot).
JW |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Mon Dec 01, 2008 7:12 pm | All times are GMT
|
|
Refinance | Loans | Loan | Loans | Debt Consolidation
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|