Re: Weird Cookie Problem - your answer

This WebDNA talk-list message is from

2007


It keeps the original formatting.
numero = 68886
interpreted = N
texte = I'll give it a try tonight, but I still have questions... If this were a daylight savings issue, wouldn't the server only not set cookies for that hour? Mine seems to not work for the 6 hours before midnight. So my code would look like this?: [format days_to_date %A, %d-%b-%Y][math]{[date]}+{00/01/0000}[showif [math]{[time]}+{06:00:00}[showif [date %Z]=CST]-{01:00:00}[/showif][/math]<[math]{06:00:00}[showif [date %Z]=CST]-{01:00:00}[/showif][/math]]+{00/01/0000}[/showi][math][/format][mat h time]{[time]}+{06:00:00}[showif [date %Z]=CST]-{01:00:00}[/showif][/math] GMT on 4/25/07 10:38 AM, Terry Wilson at terry@terryfic.com wrote: > Eddie, > > I'm just catching up with the list, and I'm surprised nobody has come > to your rescue yet with the right answer. I guess nobody is using > short term cookies. I use them on all my login sites - 30 minute and > 1-day cookies. And over time, I finally figured it out and put > together code that works. It's all about daylight savings time, and > for the 30-min, time zone adjustment. > > Anyway, the logic is that you are setting cookies at GMT, so you have > to anticipate what the actual time is there too, and GMT knows > nothing of daylight savings time. It must be correct, and allow for > daylight savings time. > > A time zone check to confirm the right daylight savings status will > adjust your hour forward or back one hour as needed. Assuming you are > on Eastern Time, use this for the time part: > > [math time]{[time]}+{05:00:00}[showif [date > %Z]=EDT]-{01:00:00}[/showif][/math] GMT > > If you want to play with shorter cookies, then the date needs to be > adjusted as well. This is the complete code for the "expires" > parameter for a 1-day cookie on Pacific time. Adjust as necessary > for your own time zone. Heck, it even allows for the turn of 12/31 to > 1/1. (In fact, I made it into a function, so I only have to insert a > simple tag for it.) > > [format days_to_date %A, %d-%b-%Y][math]{[date]}+{00/01/0000}[showif > [math]{[time]}+{08:00:00}[showif [date > %Z]=PDT]-{01:00:00}[/showif][/math]<[math]{08:00:00}[showif [date > %Z]=PDT]-{01:00:00}[/showif][/math]]+{00/01/0000}[/showif][/math][/format] > [math time]{[time]}+{08:00:00}[showif [date > %Z]=PDT]-{01:00:00}[/showif][/math] GMT > > Hope this helps! > Terry ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Weird Cookie Problem - your answer ( Terry Wilson 2007)
  2. Re: Weird Cookie Problem - your answer ( Stuart Tremain 2007)
  3. Re: Weird Cookie Problem - your answer ( Eddie Z 2007)
  4. Re: Weird Cookie Problem - your answer ( Paul Willis 2007)
  5. Re: Weird Cookie Problem - your answer ( Eddie Z 2007)
  6. Re: Weird Cookie Problem - your answer ( Terry Wilson 2007)
  7. Re: Weird Cookie Problem - your answer ( Terry Wilson 2007)
I'll give it a try tonight, but I still have questions... If this were a daylight savings issue, wouldn't the server only not set cookies for that hour? Mine seems to not work for the 6 hours before midnight. So my code would look like this?: [format days_to_date %A, %d-%b-%Y][math]{[date]}+{00/01/0000}[showif [math]{[time]}+{06:00:00}[showif [date %Z]=CST]-{01:00:00}[/showif][/math]<[math]{06:00:00}[showif [date %Z]=CST]-{01:00:00}[/showif][/math]]+{00/01/0000}[/showi][math][/format][mat h time]{[time]}+{06:00:00}[showif [date %Z]=CST]-{01:00:00}[/showif][/math] GMT on 4/25/07 10:38 AM, Terry Wilson at terry@terryfic.com wrote: > Eddie, > > I'm just catching up with the list, and I'm surprised nobody has come > to your rescue yet with the right answer. I guess nobody is using > short term cookies. I use them on all my login sites - 30 minute and > 1-day cookies. And over time, I finally figured it out and put > together code that works. It's all about daylight savings time, and > for the 30-min, time zone adjustment. > > Anyway, the logic is that you are setting cookies at GMT, so you have > to anticipate what the actual time is there too, and GMT knows > nothing of daylight savings time. It must be correct, and allow for > daylight savings time. > > A time zone check to confirm the right daylight savings status will > adjust your hour forward or back one hour as needed. Assuming you are > on Eastern Time, use this for the time part: > > [math time]{[time]}+{05:00:00}[showif [date > %Z]=EDT]-{01:00:00}[/showif][/math] GMT > > If you want to play with shorter cookies, then the date needs to be > adjusted as well. This is the complete code for the "expires" > parameter for a 1-day cookie on Pacific time. Adjust as necessary > for your own time zone. Heck, it even allows for the turn of 12/31 to > 1/1. (In fact, I made it into a function, so I only have to insert a > simple tag for it.) > > [format days_to_date %A, %d-%b-%Y][math]{[date]}+{00/01/0000}[showif > [math]{[time]}+{08:00:00}[showif [date > %Z]=PDT]-{01:00:00}[/showif][/math]<[math]{08:00:00}[showif [date > %Z]=PDT]-{01:00:00}[/showif][/math]]+{00/01/0000}[/showif][/math][/format] > [math time]{[time]}+{08:00:00}[showif [date > %Z]=PDT]-{01:00:00}[/showif][/math] GMT > > Hope this helps! > Terry ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Eddie Z

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Multithreading of [replace] (1999) webdelivery.html and webna (1997) Using Plug-In while running 1.6.1 (1997) SMSI: WebDNA Versions? (2002) New WebCatalog site! (1997) AppleScript question (1997) RequiredFields template (1997) TeaRoom (1997) creator code (1997) Ampersand Character (&) (1997) Date field search needs ... (1998) Solution to Back button (2000) Bug or syntax error on my part? (1997) emailer setup (1997) WebCat2 Append problem (B14Macacgi) (1997) Sample Tearoom Search Error (1998) Stinkin' [Referrer] (1998) Re:Remote stockroom ? (1998) WebCat hosting providers? (1997) How to include weather (2000)