Cookies again: Expiry Date
andre at andregarzia.com
Sun Sep 5 16:49:00 EDT 2010
I think you are using the wrong date format for the cookie. From wikipedia:
The expiration date tells the browser when to delete the cookie. The
expiration date is specified in the "Wdy, DD-Mon-YYYY HH:MM:SS GMT"
format. As an example, the following is a cookie sent by a Web server
(the value string has been changed):
Set-Cookie: RMID=732423sdfs73242; expires=Fri, 31-Dec-2010 23:59:59
GMT; path=/; domain=.example.net
That format is similar to the internet date but it is not the internet
date. I think you will need to assemble that out of the dateitems or
something. Other way is to encode your cookie value such as it carries
expiry information on the value field itself. For example
Then on your code you split it using # as a itemdelimiter. valueone is
your actual value, the number after the hash is "the seconds", an
exact timestamp of when the cookie was set. You can use that on your
code to invalidate a cookie if needed. This puts the control of
expiration on your hands.
On Sun, Sep 5, 2010 at 5:28 PM, stephen barncard
<stephenREVOLUTION2 at barncard.com> wrote:
> I am still having trouble dealing with the effective use of setting and
> clearing cookies properly using the Revolution server at On-Rev.
> put new header "Set-Cookie: one=datavalue"
> put new header "Set-Cookie: two=datavalue2"
> Yes, that sets the values that can be recovered, but to delete the cookie by
> attempting to set an early expiry date seems to fail every time.
> put new header "Set-Cookie: two=datavalue2 ; expires=May 5,2010;"
> put "Set-Cookie: " && tln & "=" & urlEncode(pArray[tln]) & "; expires=" &
> ("March 24, 2012") & "; path=/;" into theCookie
> put new header theCookie
> I have been around and around to all the forums and see the same posts about
> getting put new header to work last year but nothing about actual success
> setting the expiry date.
> PHP makes it easy:
> $value = "my cookie value";
> // send a cookie that expires in 24 hours
> setcookie("TestCookie",$value, time()+3600*24);
> Tested, PHP works, just like this. Sets the date, too.
> In Rev it's as if the put new header command truncates the other parameters.
> Surely someone here has a solution to this in RevTalk.
> Stephen Barncard
> San Francisco Ca. USA
> more about sqb <http://www.google.com/profiles/sbarncar>
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://www.andregarzia.com All We Do Is Code.
More information about the Use-livecode