怎样决定是否将登录内容保存到Cookie里?

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

怎样决定是否将登录内容保存到Cookie里?

  2021-03-17 我要评论
想了解怎样决定是否将登录内容保存到Cookie里?的相关内容吗,在本文为您仔细讲解的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:怎样何决决定定是是否否将将登登录录内内容容保保存存到到CCooookkiiee里里??,下面大家一起来学习吧。

login.htm<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

<% @ 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>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们