<% dim num num=request.cookies("visitnum") if num > "0" then num=num+1 Response.write "您已是第"&num&"次访问本站点了。" else Response.write "欢迎您首次访问本站。" num=1 end if response.cookies("visitnum")=num response.cookies("visitnum").expires=date+365 %> |
<% For each cookie in Request.Cookies if Request.cookies(cookie).HasKeys =false then Response.write cookie & "=" & Request.Cookies(cookie) Response.write ("<br>") Else for each key in Request.Cookies(cookie) Response.write ("<font color=blue>") Response.write cookie & ".("&key&")" & "=" & Request.Cookies(cookie)(key) Response.write ("</font><br>") next end if next %> |
<%@ LANGUAGE="VBSCRIPT" %> <% bgcolor = Request.Form("bgcolor") fgcolor = Request.Form("fgcolor") pwd = Request.form("pwd") If bgcolor <>"" or fgcolor <>"" then Response.cookies("check")("bgcolor") = bgcolor Response.Cookies("check")("fgcolor") = fgcolor Response.Cookies("check")("pwd") = pwd Response.Cookies("check").Expires=#may 01, 2004# End if '接着,读取cookie bgcolor = request.cookies("check")("bgcolor") fgcolor = request.cookies("check")("fgcolor") pwd = request.cookies("check")("pwd") '如果cookie在访问者的计算机上不存在,就创建一个表单,询问相关信息 If bgcolor ="" and fgcolor ="" and pwd="" then %> <HTML> <HEAD> </HEAD> <body> <DIV ALIGN="CENTER" > <Form action="check.asp" method="POST"> Bgcolor: <input type="text" name="bgcolor"><BR> Fgcolor: <input type="text" name="fgcolor"><BR> Password:<input type="password" name="pwd"><BR> <input type="submit" value="Submit"> </Form> </DIV> </BODY> <% End if '如果cookie已经存在,并且bgcolor存在,就跳转到color.asp。 If bgcolor <> "" then Response.Redirect "color.asp" End if %> |
<% bgcolor=request.cookies("check")("bgcolor") fgcolor=request.cookies("check")("fgcolor") pwd=request.cookies("check")("pwd") %> <%response.write("<body bgcolor="&bgcolor&"><font color="&fgcolor&">")%> 你的密码是: <%response.write(" "&pwd&" ")%> |
……