Download Informix Web DataBlade Module User`s Guide
Transcript
Using Cookies The following cookie AppPage determines whether or not the Web browser has retrieved this AppPage previously. The first time the Web browser retrieves the cookie AppPage, the AppPage sends a cookie to the Web browser, which the Web browser keeps even if it retrieves other HTML pages before retrieving this AppPage again. On any subsequent retrieval of this AppPage, the Welcome Back! message is displayed. <HTML> <HEAD><TITLE>Has the user been here before?</TITLE></HEAD> <BODY> <H2>Has the user been here before?</H2><HR> <!--- See if the flag variable has been set ---> <?MIBLOCK COND=$(XST,$flag)> <!--- Flag variable has been set ---> <B>Welcome Back! You have been here before!</B> <?/MIBLOCK> <?MIBLOCK COND=$(NXST,$flag)> <!--- Flag variable has NOT been set ---> <!--- Set a cookie ---> <?MIVAR>$(HTTPHEADER,set-cookie,flag=yes)<?/MIVAR> <B>This is the first time you have been to this page!</B> <?/MIBLOCK> </BODY> </HTML> The following is sample Web browser output the first time the cookie AppPage is retrieved. Figure 8-1 Cookie - First Request Web Browser - [Has the user been here before?] URL: http://webserver/cgi-bin/webdriver?MIval=cookie Has the user been here before? This is the first time you have been to this page! 8-6 Informix Web DataBlade Module User’s Guide