手机
当前位置:查字典教程网 >编程开发 >编程10000问 >如何决定是否将登录内容保存到Cookie里?
如何决定是否将登录内容保存到Cookie里?
摘要:login.htm精彩春风之登录页面我要登录随风起舞电子邮件:口令:要把登录内容存为Cookie吗?checklogin.asp精彩春风之登...

login.htm

<% @ Language=javascript %>

<%

if (Request.Cookies("SavedLogin").HasKeys) {

Response.Redirect("checklogin.asp?Cookie=1")

}

%>

<html>

<head>

<title>精彩春风之登录页面</title>

</head>

<body>

我要登录随风起舞

<FORM ACTION="CheckLogin.asp" METHOD="POST">

电子邮件: <INPUT TYPE="Text" NAME="email" SIZE="40"><BR>

口令: <INPUT TYPE="Password" NAME="Password" SIZE="40"><P>

<INPUT TYPE="Checkbox" NAME="SaveLogin"> 要把登录内容存为Cookie吗?<P>

<INPUT TYPE="Submit" VALUE="登录"><INPUT TYPE="RESET">

</FORM>

checklogin.asp

<%

dim strEmail

if Request.QueryString("Cookie") = 1 then

strEMail = Request.Cookies("SavedLogin")("Email")

else

strEMail = Request.Form("email")

end if

dim bLoginSaved

if Request.Form("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>

<% if Request.QueryString("Cookie") = 1 then %>

保存成功!<P>

<% end if %>

请确认您的电子邮件: <% = strEMail %>

</body></html>

【如何决定是否将登录内容保存到Cookie里?】相关文章:

如何实时获知多少人在线?

如何验证字符串是否包含有效字符?

如何简单地上传文件?

如何判断URL格式是否符合规范?

如何实现文件上传并自动归类功能?

如何实现无组件上传二进制文件?

如何远程读取数据库页面?

如何获取文件的名称和扩展名?

如何用Cookie进行登录验证?

如何显示最后十名来访者?

精品推荐
分类导航