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:

no global [username] or [password] displayed ... (1997) Web Commerce thoughts and needs.. (1996) WebCat2final1 crashes (1997) WebCatalog for Postcards ? (1997) WebCatalog 4.0 & Tenon iTools (2000) Last Day of the Month (2005) WebCat2 - [format thousands] (1997) ShipCost Data Base (1998) show all problem (1997) osx 10.3,webcat,permissions (2004) [Very OT] Cards (2004) Problems with dbcatalog.exe (1997) Search (1997) Your Pay XML / LinkPoint (2005) PIXO (1997) [/application] error? (1997) Forcing a NEWCART (1997) Sami (1998) 2.0 Info (1997) Bugs still *not* fixed as promised ... (2000)