现在的位置: 首页 > 综合 > 正文

如何用Cookie进行登录验证?

2013年06月07日 ⁄ 综合 ⁄ 共 692字 ⁄ 字号 评论关闭

login.htm
请注册登录随风起舞
<FORM ACTION="checklogin.asp" METHOD="POST">
电子邮件: <input TYPE="Text" NAME="email" SIZE="40">
密码: <input TYPE="Password" NAME="Password" SIZE="40">
<input TYPE="Checkbox" NAME="SaveLogin" value="ON">
您要将注册内容保存为Cookie?
<input TYPE="Submit" VALUE="
登录"><input TYPE="RESET">
</FORM>

checklogin.asp
<%
dim bLoginSaved
if Request("SaveLogin") = "on" then
Response.Cookies("SavedLogin")("EMail") = Request("email")
Response.Cookies("SavedLogin")("pw") = Request("password")
Response.Cookies("SavedLogin").Expires = Date + 30
bLoginSaved = True
else
bLoginSaved = False
end if
%>

<html>
<head>

<title>山水盈盈之登录验证</title>

</head>
<body>
<% if bLoginSaved then %>
将注册内容保存到Cookie<HR>
<% end if %>
欢迎光临随风起舞!<P>
请确认您的电子邮件: <% = Request("email") %>
</body></html>

抱歉!评论已关闭.