Hi Jon,

Dealing with expiry dates and cookies is often a PITA!

Rasmus suggested a way around this a few weeks ago - here is a rehash of
what he said:

Do this:
setcookie ('expiry', time ());

This call will have created a session cookie - this means that the session
will expire when the browser closes the client.

Now you have a cookie var called expiry that has the unix timestamp of when
the user first accessed the site.  Check this value when deciding to expire
the user's session.

ie.

$timeout = 3600;    // Set an expiry date of an hour

if ($expiry + $timeout > time ()) {

    // handle that the cookie has expired

}

(Actually, you easily do this with sessions too.)

HTH,

--zak

Jon Yaggie wrote:
[...]
> I have set up a user login so that it will assign a cookie for one
> hour - setcookie("cookie_id", $id, time()+3600);

> The manner in which i suse the expiration is copied form the manual but
> i have actually tried several alteratives.  The problem is the
> expiration works perfectly locally (i am running apache 1.3 for windows)
> but once i upload it (linux red hat 5.2 (why so old i dont know)/ apache
> 1.3.19.)  The expiration will not work on my browser(s) unless i
> increase the expiration to +5000 or above.  My client tests it using the
> same version of IE i have and it will not set the cookie still at +5000
> for him.

> Now i understand from browser to browser there can be differences but
> why can i set a cookie for +200 locally but not for less than +5000
> uploaded when i am most certainly checking it with the same browser (IE
> 5.5)




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to