use to set a cookie:
    set headers [ns_conn outputheaders]
    ns_set put $headers "set-cookie" "$headerName=$headerValue ;path=/"

use to extract a cookieName from the cookie header:
  set header [ns_set iget [ns_conn headers] "cookie"]
  if { [regexp "${cookieName}=(\[^ ;\]*)" $header match cookieValue] } \
  {
    ## cookieValue will have the correct value if you're inside the if...


cookies are quirky- keep the path and expires value under tight wraps.  if
you set the expires value, the browser writes it to disk, otherwise it's
only for the session (as long as that browser or its children are open).

useful cookie site:
http://home.netscape.com/newsref/std/cookie_spec.html



-----Original Message-----
From: AOLserver Discussion [mailto:[EMAIL PROTECTED]]On Behalf
Of Khaldoun Shobaki
Sent: Wednesday, July 11, 2001 9:43 AM
To: [EMAIL PROTECTED]
Subject: [AOLSERVER] User Authentication Questions


Hi,

<longwindednewbieintro>
I'm new to AOLserver and to the list.  Please forgive me
if I ask some stupid questions.  I've been searching thru
the archives and the net with limited luck, so I've given
up and am sending message to the list.
</longwindednewbieintro>

I'm setting up a site where I would like users to be
required to login with username/password at begin of
session.  I've not used cookies before, but I think that's
going to be the way I want to go.  The user will be able
to edit personal preferences, etc, and this seems like a
good way to keep track of things.

A typical scenario:
1. User logs in.
2. User browses through various files on site, compiling a list
   as they go.
3. User saves this list in their personal preferences.
4. User logs off.

Anyway, I have a decent amount of Tcl/Tk experience, but
have not been able to find a good pile of example code for
similar things to what I describe above.  The number of
users will be very small (10 or so max).  Can anyone point
me to some good sources of information or examples?  I get
the feeling that all I need to do is look at some Tcl that
does similar stuff and it will all "click" for me.

Thanks,
-kal

Reply via email to