home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Spezial
/
SPEZIAL2_97.zip
/
SPEZIAL2_97.iso
/
ANWEND
/
ONLINE
/
SREFV12J
/
SAMPCOOK.RX0
< prev
next >
Wrap
Text File
|
1997-01-07
|
1KB
|
41 lines
/* This is a simple demonstration of the use of cookies with sre-filter. */
/* To use it, put the following line in your html document:
<!-- interpret file sampcook.rxx -->
(and be sure this file is in your "goserve working directory")
*/
/* If "send in pieces" selected, the adding to header is impossible, so
we have an ERROR! */
if send_piece=1 then do
queue "<strong> ERROR: </strong> SRE-Filter can not set cookies using SSI's "
queue ' when <strong> DO_SEND_PIECE="YES" </strong>!'
end
else do
/* determine if we have a "LAST_ACCESS" cookie */
tmp.say=sref_get_cookie('LAST_ACCESS',1)
if tmp.say=' 'then
tmp.say='This is your first access to ' docname
else
tmp.say=' Last access to ' docname ' was on: ' tmp.say
queue tmp.say
/* write out all cookies */
tmp.cookies=reqfield('cookie:')
queue " <hr> Note that your cookies are: <br> <b> " tmp.cookies " </b> <p> "
/* check on browser */
tmp.!browser=reqfield('User-agent:')
tmp.!docook=sref_browser_info('COOKIES')
if tmp.!docook<>'YES' then
queue '<br> Our info shows that your browser ('tmp.!browser ') does <b>not</b> understand cookies!<br> '
else
queue '<br> Our info shows that your browser ('tmp.!browser ') <b>does</b> understand cookies! <br>'
/* add a "LAST_ACCESS" cookie for the invoking URL */
boo='last_access='||date()' 'time() ' ; path=/'|| docname
'header add set-cookie: '|| translate(boo,'_',' ')
end