read and write you own cookies with webcat

This WebDNA talk-list message is from

1997


It keeps the original formatting.
numero = 14846
interpreted = N
texte = Greetings:If you need cookie support, here is an example of a cookie that counts the number of times someone visits your homepage. A page (default.tpl) reads the cookie and, if it finds it, adds one to the number of visits. If not it assigns 1 to the variable visits then it writes the cookie and redirects to your URL. You can easily modify this example to capture any kind of data you wish.1. Set up a default .tpl/.tmpl page with the following webDNA:=== begin default.tpl[ListCookies name=Visits] [math show=F]visits=[value]+1[/math] [/ListCookies][hideif [math]visits[/math]>0] [math show=F]visits=1[/math] [/hideif][returnraw]HTTP/1.0 302 Found Set-Cookie: Visits=[math]visits[/math]; expires=Wednesday, 09-Nov-1999 23:12:40 GMT; path=/; domain=www.yourdomain.com Location: home.tpl[/returnraw]=== end default.tpl2. Set up your default home page to accept this information for processing like:=== begin home.tpl My Title [ListCookies name=Visits] [showif [value]=1] Welcome! This is your first visit to our website. [/showif] [showif [value]>1] Welcome Back! Glad to see you have visited [value] times! [/showif] [showif [value]=100] But 100 times? Get a life! [/showif] [/ListCookies] === end home.tplMake sure you change the domain to your own domain and change the location to your home page.Aloha, Olin..................................................................... . W o r l d P o i n t Olin Kealoha Lagon . . The Language Company(TM) director, special projects . . . . Honolulu San Francisco olin@worldpoint.com . . 2800 woodlawn drive 222 sutter street www.worldpoint.com . . suite 170 sixth floor (v) 808.539.3978 . . honolulu, hi 96822 san francisco, ca 94108 (f) 808.539.3943 . . . . Over 3,000 Translators - Any Language, Any Time, Any Place . ..................................................................... Associated Messages, from the most recent to the oldest:

    
  1. Re: read and write you own cookies with webcat (Sandra L. Pitner 1997)
  2. Re: read and write you own cookies with webcat (Kenneth Grome 1997)
  3. Re: read and write you own cookies with webcat (Olin 1997)
  4. Re: read and write you own cookies with webcat (Kenneth Grome 1997)
  5. Re: read and write you own cookies with webcat (Sandra L. Pitner 1997)
  6. Re: read and write you own cookies with webcat (Olin 1997)
  7. Re: read and write you own cookies with webcat (Sandra L. Pitner 1997)
  8. Re: read and write you own cookies with webcat (Grant Hulbert 1997)
  9. Re: read and write you own cookies with webcat (Sandra L. Pitner 1997)
  10. read and write you own cookies with webcat (Olin 1997)
Greetings:If you need cookie support, here is an example of a cookie that counts the number of times someone visits your homepage. A page (default.tpl) reads the cookie and, if it finds it, adds one to the number of visits. If not it assigns 1 to the variable visits then it writes the cookie and redirects to your URL. You can easily modify this example to capture any kind of data you wish.1. Set up a default .tpl/.tmpl page with the following webDNA:=== begin default.tpl[ListCookies name=Visits] [math show=F]visits=[value]+1[/math] [/ListCookies][hideif [math]visits[/math]>0] [math show=F]visits=1[/math] [/hideif][returnraw]HTTP/1.0 302 Found Set-Cookie: Visits=[math]visits[/math]; expires=Wednesday, 09-Nov-1999 23:12:40 GMT; path=/; domain=www.yourdomain.com Location: home.tpl[/returnraw]=== end default.tpl2. Set up your default home page to accept this information for processing like:=== begin home.tpl My Title [ListCookies name=Visits] [showif [value]=1] Welcome! This is your first visit to our website. [/showif] [showif [value]>1] Welcome Back! Glad to see you have visited [value] times! [/showif] [showif [value]=100] But 100 times? Get a life! [/showif] [/ListCookies] === end home.tplMake sure you change the domain to your own domain and change the location to your home page.Aloha, Olin..................................................................... . W o r l d P o i n t Olin Kealoha Lagon . . The Language Company(TM) director, special projects . . . . Honolulu San Francisco olin@worldpoint.com . . 2800 woodlawn drive 222 sutter street www.worldpoint.com . . suite 170 sixth floor (v) 808.539.3978 . . honolulu, hi 96822 san francisco, ca 94108 (f) 808.539.3943 . . . . Over 3,000 Translators - Any Language, Any Time, Any Place . ..................................................................... Olin

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:

WC2.0 Memory Requirements (1997) A question about security (1998) Placement of .tpl files? (2000) WebCat2 - storing unformatted date data? (1997) Shipping Costs Not Updating When Adding Items (1997) [isfolder] and [filename] (1997) How is it done? (1998) [LOOKUP] (1997) Adding up weights (1998) A quickie question (1997) Insufficient memory, OSX WebCat bug or what??? (2000) different ship dates and shopping carts -- how to? (1997) NetForms for mail, sorry (1998) Download URL & access on the fly ? (1997) [WebDNA] listfiles bugs on linux (2009) Re:redirect from the errorsMessages.db entry (1997) search problem (2002) OT: Euros to Dollars (2008) [WebDNA] [thisurlplusget] and [thisurl] - misbehaves (2012) problems with 2 tags (1997)