Basic HTML version of Foils prepared 23 June 1997

Foil 73 Use of Cookies in Server Program

From JavaScript Tutorial for Certificate Course UC Web applications Certificate -- Summer 97. by Geoffrey C. Fox, Tom Scavo


In HTTP header, the brower passes to server any cookies that are valid for a given page
Note only name=value is passed since PATH, DOMAIN, SECURE, and EXPIRES are used to check if cookie should be passed
The server stores cookie strings in $HTTP_COOKIE environment variable as name1=value1; name2=value2;
  • A simple CGI script can decode this environment variable
One can send cookies back to client using
Set-cookie: name1=value1; EXPIRES=...; ...
before the
content-type: text/html
header line



Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998