Re: read and write you own cookies with webcat

This WebDNA talk-list message is from

1997


It keeps the original formatting.
numero = 14852
interpreted = N
texte = Thanks for the low-calorie cookie recipes! Is a redirect necessary or is that the only way to actually write the cookie? Thanks again!Sandy Olin wrote: > > 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.tpl > > 2. Set up your default home page to accept this information for > processing like: > > === begin home.tpl > > > > > > My Title > > > > vlink=#990000> > > [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.tpl > > Make 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)
Thanks for the low-calorie cookie recipes! Is a redirect necessary or is that the only way to actually write the cookie? Thanks again!Sandy Olin wrote: > > 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.tpl > > 2. Set up your default home page to accept this information for > processing like: > > === begin home.tpl > > > > > > My Title > > > > vlink=#990000> > > [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.tpl > > Make 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 . > ..................................................................... Sandra L. Pitner

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:

Passing Variables.. yikes, I'm dumb (2000) Another question about credit cards (1997) quick question. (2007) Generating Options for a Form. (1997) RE: anyone know how to restart dbserver on NT automatically (1999) [Sum] function? (1997) Press Release hit the NewsWire!!! (1997) Https not showing products (2004) Re:Emailer and encryption (1997) Google MAP URLs (2006) strange IE 4.0 (1998) Security Question (1997) PCS Frames (1997) Menu to select product variations (1997) Re:Help name our technology! (1997) Download (1999) WC on Mac OS X or Mac OS X Server 2.x (2001) Server problem? (1998) exclamation mark... (1999) Pass a form (2003)