Learn from sources
       Member COOKIE2 in CGIDEV2 / DEMOHTML

 «as400»top
 content-type: text/html
 /%setmycookie%/
 Expires: 0
 X-XSS-Protection: 1;
 
 «!doctype html»
 «HTML»
   «HEAD»
     «TITLE»Managing cookies with CGI - Advanced approach«/TITLE»
 «meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"»
 «META NAME="ROBOTS" CONTENT="INDEX,NOFOLLOW"/»
 
 «style type="text/css"»
 .title { font-family:  Arial, sans-serif; font-weight: normal; font-size: 24px; }
 .subtitle { font-family: Arial, sans-serif; font-weight: normal; font-size: 15px; }
 .boldtitle { font-family:  Arial Black, Arial, sans-serif; font-weight: Helvetica Black, bold; font-size: 24px; }
 .mono { font-family: courier; font-size: 78%; }
 td,th,caption { font-family: Arial, sans-serif; font-size: 78%; }
 pre { font-family: monospace; font-weight: normal; font-size: 12px; }
 «/style»
 «script language="JavaScript"»
 function TS()  {ts=Math.random(); return ts;}
 «/script»
 «/HEAD»
 
 «BODY»
 
 «table»
 «tr»«td»
         «div class=boldtitle»
         Managing cookies with CGI - Advanced approach
         «/div»
         «img src="/cgidev/blue.gif" alt="blue line" width="600" height="1"»
 «tr»«td»«p»«b»The following http header was just sent:«/b»«/p»
         «table border=1»
         «tr»«td class=mono»/%setmycookie%/
                 «/td»«/tr»
         «/table»
         «/td»«/tr»
 «/table»
 «br»«br»
 
 «as400»cookieno
 «table»
 «tr»«td»«b»Cookie «font color=red»«b»/%cookienam%/«/b»«/font» not available to this page.«/b»
         «/td»«/tr»
 «/table»
 
 «as400»cookieyes
 «table»
 «tr»«td»
 «tr»«td»«b»Cookie «font color=red»/%cookienam%/«/font» could be retrieved.«/b»
         «p»Its value is:
         «table border=1»
         «tr»«td class=mono»/%cookieval%/«/td»«/tr»
         «/table»
         «/td»«/tr»
 «/table»
 
 «as400»endhtml
 «table width="600"»
 «tr»«td»«img src="/cgidev/blue.gif" alt="blue line" width="600" height="1"»
         «/td»«/tr»
 «tr»«td align=center»
         «form method=post action="/cgidev2p/cookie2.pgm"»
         «script language=javascript»
         document.write("«input type=hidden name=xdocloc value='"+document.location+"'»")
         document.write("«input type=hidden name=ts value="+TS()+"»")
         «/script»
         «input type=hidden name=dummy value="/%timenow%/"»
         «table»
         «tr»«td align=center»«input type=submit value=" Try again "»
                 «/form»«/td»«/tr»
         «/table»
         «/td»«/tr»
 «/table»
 «table width="600"»
 «tr»«td»
         «a href="/cgidev2p/dspsrc.pgm?cgiinp01=cgidev2&cgiinp02=demohtml&cgiinp03=cookie2"
          target="_blank"»«b»Display the external html source«/b»«/a»«/td»
     «td align=right»
         «a href="/cgidev2p/dspsrc.pgm?cgiinp01=cgidev2&cgiinp02=qrpglesrc&cgiinp03=cookie2"
          target="_blank"»«b»Display the RPG source«/b»«/a»«/td»
         «/td»«/tr»
 «/table»
 «br»«br»
 «table width="600"»
 «tr»«td»«img src="/cgidev/blue.gif" alt="blue line" height="1" width="30%"»
         «/td»«/tr»
 «tr»«td»«b»Note«/b».
         The CGI receives the information about the available
         cookies as soon as it is called.«br»
         Subsequently the CGI provides the html response.
         While loading the html response, the web browser
         creates / updates the cookie sent from the CGI.«br»
         This explains why the CGI is not listing the latest version
         of the cookie just sent.
         «/td»«/tr»
 «/table»
 «/BODY»
 «/HTML»
0.029 sec.s