Re: Set Cookie Problem

This WebDNA talk-list message is from

2008


It keeps the original formatting.
numero = 69700
interpreted = N
texte = It's not the time, it's the date. You are=20 potentially setting a cookie that is already=20 expired. If it's 9 pm CST, it's 3 am the next day=20 there in the UK. So you have to have to add=20 another day if the GMT lands past midnight. Your=20 time math is probably only screwing it up during=20 standard time -- during Daylight Savings,=20 subtract 1 hour, as mean time doesn't do savings=20 time. It's a very tough concept that took me a lot of=20 quiet time to finally figure out. Here is what I use for my sites that are on a=20 Pacific Time Zone server. Actually I made a=20 function for various expirations (30 min, 1 day,=20 3 day, year, etc) because it's too complex): for a 1 day cookie (adjust offset and time zone to suit): [format days_to_date %A,=20 %d-%b-%Y][math]{[date]}+{00/01/0000}[showif=20 [math]{[time]}+{08:00:00}[showif [date=20 %Z]=3DPDT]-{01:00:00}[/showif][/math]<[math]{08:00:00}[showif=20 [date=20 %Z]=3DPDT]-{01:00:00}[/showif][/math]]+{00/01/0000}[/showif][/math][/format]= =20 [math time]{[time]}+{08:00:00}[showif [date=20 %Z]=3DPDT]-{01:00:00}[/showif][/math] GMT Terry >Date: Sun, 20 Jan 2008 12:21:43 -0600 >Subject: Re: Post Test - Set Cookie Problem >From: Eddie Z >Message-ID: >Content-type: text/plain > >I've been struggling with this set cookie command for years. I finally >realized something is wrong with the time math. > >The code is: >[setcookie name=3Dnerconsecure&value=3D[userID]&expires=3D[format= days_to_date %A, >%d-%b-%Y][math]{[date]}+1[/math][/format] [math >time]{[time]}+{05:00:00}[/math] GMT&path=3D/&domain=3Dnercon.thinksite.com] > >No one could tell me what the issue was, but I just realized that I couldn= =B9t >set cookies during the last several hours of the day. I took out the time >math and it started to work right away. What=B9s wrong with my code? I=B9m = CST, >but I think GMT + 5 is EST. -- 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: Set Cookie Problem ( John Peacock 2008)
  2. Re: Set Cookie Problem ( Terry Wilson 2008)
  3. Re: Post Test - Set Cookie Problem ( Charles Kline 2008)
  4. Re: Post Test - Set Cookie Problem ( Eddie Z 2008)
It's not the time, it's the date. You are=20 potentially setting a cookie that is already=20 expired. If it's 9 pm CST, it's 3 am the next day=20 there in the UK. So you have to have to add=20 another day if the GMT lands past midnight. Your=20 time math is probably only screwing it up during=20 standard time -- during Daylight Savings,=20 subtract 1 hour, as mean time doesn't do savings=20 time. It's a very tough concept that took me a lot of=20 quiet time to finally figure out. Here is what I use for my sites that are on a=20 Pacific Time Zone server. Actually I made a=20 function for various expirations (30 min, 1 day,=20 3 day, year, etc) because it's too complex): for a 1 day cookie (adjust offset and time zone to suit): [format days_to_date %A,=20 %d-%b-%Y][math]{[date]}+{00/01/0000}[showif=20 [math]{[time]}+{08:00:00}[showif [date=20 %Z]=3DPDT]-{01:00:00}[/showif][/math]<[math]{08:00:00}[showif=20 [date=20 %Z]=3DPDT]-{01:00:00}[/showif][/math]]+{00/01/0000}[/showif][/math][/format]= =20 [math time]{[time]}+{08:00:00}[showif [date=20 %Z]=3DPDT]-{01:00:00}[/showif][/math] GMT Terry >Date: Sun, 20 Jan 2008 12:21:43 -0600 >Subject: Re: Post Test - Set Cookie Problem >From: Eddie Z >Message-ID: >Content-type: text/plain > >I've been struggling with this set cookie command for years. I finally >realized something is wrong with the time math. > >The code is: >[setcookie name=3Dnerconsecure&value=3D[userID]&expires=3D[format= days_to_date %A, >%d-%b-%Y][math]{[date]}+1[/math][/format] [math >time]{[time]}+{05:00:00}[/math] GMT&path=3D/&domain=3Dnercon.thinksite.com] > >No one could tell me what the issue was, but I just realized that I couldn= =B9t >set cookies during the last several hours of the day. I took out the time >math and it started to work right away. What=B9s wrong with my code? I=B9m = CST, >but I think GMT + 5 is EST. -- 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:

ConverChars (1999) counting characters and/or words (1997) Search in 2 or more catalogs (1997) random in arizona (2003) Search with Special Chars (1997) Runtime (1998) Why does this not work? (2002) OT: typhoon manual (2000) Using grep to parse Canadian Postal Codes (2002) Where is the linux 4.02b5 FTP download located? (2000) Emailer setup (1997) SetHeader Requirements (2002) shaopping cart limits (2000) NT - Thanks and Taxes (1997) WC2.0 Memory Requirements (1997) WCS Newbie question (1997) Phonetic Search (2001) WebCatalog2 Feature Feedback (1996) Opinion: [input] should be called [output] ... (1997) WebCat2b15MacPlugIn - [authenticate] not [protect] (1997)