Hi,
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??
Thanks in advance,
Stephen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Stephen A. Readman Email: [EMAIL PROTECTED]
DDI:+44-(0)131-331-6441
Seven Layer Communications Ltd.
Edinburgh, EH30 9TG. Tel:+44-(0)131-331-7777
Web:www.slayer.com Fax:+44-(0)131-331-7772
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?
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
# once buffering is switched off, it is no longer possible to
# maninuplate headers
buffered off
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]