[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
$! 15-APR-1999  MGD  refinements
$! ??-???-1997  MGD  lost in the mists of time
$! set verify
$! show symbol www_*
$ say = "write sys$output"
$!
$ CookiePath = WWW_SCRIPT_NAME + "/"
$!
$ if f$type(WWW_HTTP_COOKIE) .NES. ""
$ then
$!   (process a cookie sent from the client)
$    Location = f$locate("WASD_COOKIE_DEMO",WWW_HTTP_COOKIE)
$    if Location .lt. f$length(WWW_HTTP_COOKIE)
$    then
$       Cookie = f$extract(Location,999,WWW_HTTP_COOKIE)
$       Cookie = f$element(0,";",Cookie)
$       Cookie = f$element(1,"=",Cookie)
$       CookieCount = f$integer(f$element(0,"_",Cookie))
$       CookieTime = f$element(1,"_",Cookie) + " " + f$element(2,"_",Cookie)
$    else
$       CookieCount = 0
$       CookieTime = ""
$    endif
$ else
$    CookieCount = 0
$    CookieTime = ""
$ endif
$!
$ if WWW_PATH_INFO .eqs. "/reset"
$ then
$!   (reset the cookie by providing expiry date in the past)
$    say "Content-Type: text/html"
$    say "Set-Cookie: WASD_COOKIE_DEMO=''Cookie'; path=''CookiePath'; " + -
         "expires=""Fri, 13-Jan-1978 14:00:00 GMT"""
$    say "Expires: Fri, 13-Jan-1978 14:00:00 GMT"
$    say ""
$    say "<HTML>"
$    say "<HEAD>"
$    say "<TITLE>Cookie Reset Demonstration</TITLE>"
$    say "</HEAD>"
$    say "<BODY>"
$    say "Done!"
$    say "</BODY>"
$    say "</HTML>"
$    exit
$ endif
$!
$!(create cookie to send back to client)
$ CookieCount = CookieCount + 1
$ DateTime = f$time()
$ if f$extract(0,1,DateTime) .eqs. " " -
     then DateTime = "0" + f$extract(1,99,DateTime)
$ Date = f$element(0," ",DateTime)
$ Time = f$extrcat(0,8,f$element(1," ",DateTime))
$ Cookie = "WASD_COOKIE_DEMO=''CookieCount'_''Date'_''Time'; path=''CookiePath'"
$!
$!(HTTP response including cookie and HTML page)
$ say "Content-Type: text/html"
$ say "Set-Cookie: ''Cookie'"
$ say "Expires: Fri, 13-Jan-1978 14:00:00 GMT"
$ say ""
$ say "<HTML>"
$ say "<HEAD>"
$ say "<TITLE>Cookie Demonstration</TITLE>"
$ say "</HEAD>"
$ say "<BODY>"
$ say "<H1>Cookie Demonstration</H1>"
$ if f$type(WWW_HTTP_COOKIE) .EQS. ""
$ then
$    say "This is the first time you have used this demonstration."
$    say "<P>Use it again straight away!"
$ else
$    say "You have used this demonstration <U>''CookieCount' times</U>;" + -
         "&nbsp; Last at&nbsp; <U>''CookieTime'</U>"
$    say "<P>The cookie returned was: <PRE>  ''WWW_HTTP_COOKIE'</PRE>"
$    say "<P>The cookie set this time was: <PRE>  ''COOKIE'</PRE>"
$    say "<P>The demonstration was produced using " + -
         "<A HREF=""/ht_root/src/other/cookie_demo.com"">" + -
         "this very simple DCL CGI script</A>!"
$    say "<P><A HREF=""''WWW_SCRIPT_NAME'/reset"">Reset the cookie</A>"
$    say "&nbsp;<FONT SIZE=-1>(IE4 doesn't seem to want to do this!)</FONT>"
$ endif
$ say "</BODY>"
$ say "</HTML>"