<%
if request("admin")=" 登 陆 " then UserName=request.form("UserName") PassWd=md5(request.form("PassWd")) set rs=server.CreateObject("ADODB.RecordSet") sql="select * from [user] where username='"&UserName&"'" rs.Open Sql,conn,1,1 if rs("password")<>PassWd then response.write"<script>alert('用户或密码错误');location.href='javascript:history.go(-1)';</script>" response.end else Response.Cookies("key")="gu_ke" Response.Cookies("key").expires=date+2 Response.Cookies("user")=rs("username") Response.Cookies("user").expires=date+2 Response.Cookies("wangdian")=rs("wangdian") Response.Cookies("wangdian").expires=date+2 Response.Cookies("id")=rs("id") Response.Cookies("id").expires=date+2 response.redirect "admin.asp" end if rs.close end if %>注意红色部分是response.cookies
引用时红色部分
<td><font color="ffffff">用户:<b><%=Request.Cookies("user")%></b> </font> <a href="quit.asp" target="_top"><font color="#ffffff">登出</font></a></td>