--- "Sabina A. Schneider" <[EMAIL PROTECTED]>
wrote:
> I don't want to take much time, but I'm
> still having problems with cookies

Sabina,

First, to answer your question of path, you should start
with / as it is the least restrictive. You can always try
restricting cookies per directory later, but it is best to
just use that until you get things working.

As for date, there is no way to make a cookie last forever.
In fact, I am pretty sure (but don't feel like looking it
up) that there is a maximum lifetime of a cookie in the
specification - two years comes to mind, but it might be
shorter. The only three options you have are:

1. No date - this makes it a session cookies that expires
as soon as the browser session ends (all instances of the
browser terminate).
2. Set a date to the current date or a date in the past -
This effectively deletes a cookie.
3. Set a date in the future - This indicates the lifetime
of the cookie.

As a really simple test, try this:

page1.php:
----------
<? header("Set-Cookie: foo=bar); ?>
<a href="page2.php">

page2.php:
----------
<pre>
<? print_r($_COOKIE); ?>
</pre>

If you don't see anything on page 2, either your browser
did not supply the cookie, or your version of PHP is too
old to have the $_COOKIE superglobal.

Hope that helps.

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to