You may already know this, but be sure to set an expiration time.  Any
browser will drop your cookie at the end of its run if you don't specify an
expiration date/time.
--
Mark Hubbard: [EMAIL PROTECTED]
Microsoft Certified Professional

"My grandfather once told me that there are two kinds of people:
those who work and those who take the credit. He told me to try
to be in the first group; there was less competition there."
   - Indira Gandhi

----- Original Message -----
From: David N. Welton <[EMAIL PROTECTED]>
To: Stephen A Readman <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 08, 2002 1:09 PM
Subject: Re: Vanishing cookies??


> "Stephen A Readman" <[EMAIL PROTECTED]> writes:
>
> > I'm pretty new to mod_dtcl, but I can't seem to set cookies
> > properly, basically I've written a module that allows users to
> > browse the servers directory structure, but I want to use a cookie
> > to store the last directory the user browsed and present it to them
> > next time they visit the page.
>
> > The cookie seems to persist for the duration of the client, but once
> > I destroy and restart my browser - no cookie??
>
> Hrm, I think I recall someone having a similar problem, once upon a
> time.  You might check to make sure the cookie looks right (follow the
> server interaction with a system call trace on the apache process, or
> something similar).  I wonder if it's a browser problem?  You might
> also look through the list archives...
>
> >  <?
> > headers setcookie "foo" "bar" # we have to put this before any 'hputs'
statements
>
> > hgetvars
>
> >    if {! [var exists dir]} {
>
> >      #Check for the cookie
> >      if { [ array exists COOKIES ] } {
> >  if { [array get COOKIES DirBrowserDir] != "" } {
> >    #Found the cookie var - use it
> >      set gstrDir [lindex [array get COOKIES DirBrowserDir] end]
> >         } else {
> >           #Cookie var wasn't found - default the dir
> >    set gstrDir {/}
> >       }
> >      } else {
> >  #no cookie array - default the dir
> >   set gstrDir {/}
> >      }
>
> >    } else {
>
> >      #Use the var passed in
> >      set gstrDir [var get dir]
> >      if {$gstrDir == ""} {
> >        set gstrDir {/}
> >      }
> >    }
>
> >    #Remember the dir for next session
> >    headers setcookie -name "DirBrowserDir" -value $gstrDir
>
> maybe put an expiration time?
>
> > # once buffering is switched off, it is no longer possible to
> > # maninuplate headers
> > buffered off
>
>
> --
> David N. Welton
>    Consulting: http://www.dedasys.com/
>      Personal: http://www.dedasys.com/davidw/
> Free Software: http://www.dedasys.com/freesoftware/
>    Apache Tcl: http://tcl.apache.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to