当前位置: 移动技术网 > IT编程>开发语言>其他编程 > 如何决定是否将登录内容保存到Cookie里?

如何决定是否将登录内容保存到Cookie里?

2017年12月08日  | 移动技术网IT编程  | 我要评论

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>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网