Re: Weird Cookie Problem - your answer

This WebDNA talk-list message is from

2007


It keeps the original formatting.
numero = 68874
interpreted = N
texte = 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 -- Terry Wilson | terry@terryfic.com | http://terryfic.com http://WhosComing.com - a simplified, affordable online reservation system http://TightJacket.com -- stylish protection for your laptop -------------------------------------------------------------------------- Attitude is the only difference between ordeal and adventure. ------------------------------------------------------------- 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)
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 -- Terry Wilson | terry@terryfic.com | http://terryfic.com http://WhosComing.com - a simplified, affordable online reservation system http://TightJacket.com -- stylish protection for your laptop -------------------------------------------------------------------------- Attitude is the only difference between ordeal and adventure. ------------------------------------------------------------- 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/ Terry Wilson

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:

WC2b15 - [HTMLx]...[/HTMLx] problems SOLVED! (1997) hiding blank fields (2003) Is Web Merchant Necessary? (2000) PIXO Support (1997) HomePage Caution (1997) WebCat2b12 Mac.acgi--[searchstring] bug (1997) Location of Browser Info.txt file (1997) Question (2001) emailer prob (1998) [WebDNA] [OT] MySQL Users (2011) customer info (2001) off-topic - printinglib 68K (1997) Problem (1997) Thanks for Encrypt.tpl - A Question (1999) Mozilla/4. and Browser Info.txt (1997) Moment of Thanks (1997) Item in Cart 2 times - Any code? (2000) E 5 Mac Authentication trouble (2000) WC Database Format (1997) Sorting by date (1997)