欢迎来到代码驿站!

当前位置:首页 >

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

时间:2021-04-01 08:18:25|栏目:|点击:

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>

上一篇:如何动态生成WBMP?

栏    目:

下一篇:Powershell小技巧之通过EventLog查看近期电脑开机和关机时间

本文标题:如何决定是否将登录内容保存到Cookie里?

本文地址:http://www.codeinn.net/misctech/92345.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有