加入收藏 | 设为首页 | 会员中心 | 我要投稿 大同站长网 (https://www.0352zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

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

发布时间:2016-11-29 17:20:03 所属栏目:MySql教程 来源:站长网
导读:login.htm lt;% @ Language=#106avascript %gt; lt;% if (Request.Cookies("SavedLogin").HasKeys) { nbsp; nbsp; Response.Redirect("checklogin.asp?Cookie=1") } %gt; lt;htmlgt; lt;headgt; lt;titlegt;精彩春风之登录页面lt;/titlegt; lt;/headgt; lt

login.htm

lt;% @ Language=#106avascript %gt;
lt;%
if (Request.Cookies("SavedLogin").HasKeys) {
nbsp; nbsp; Response.Redirect("checklogin.asp?Cookie=1")
}
%gt;

lt;htmlgt;
lt;headgt;

lt;titlegt;精彩春风之登录页面lt;/titlegt;

lt;/headgt;
lt;bodygt;
我要登录随风起舞
lt;FORM ACTION="CheckLogin.asp" METHOD="POST"gt;
nbsp; nbsp; 电子邮件: lt;INPUT TYPE="Text" NAME="email" SIZE="40"gt;lt;BRgt;
nbsp; nbsp; 口令: lt;INPUT TYPE="Password" NAME="Password" SIZE="40"gt;lt;Pgt;
nbsp; nbsp; lt;INPUT TYPE="Checkbox" NAME="SaveLogin"gt; 要把登录内容存为Cookie吗?lt;Pgt;
nbsp; nbsp; lt;INPUT TYPE="Submit" VALUE="登录"gt;lt;INPUT TYPE="RESET"gt;
lt;/FORMgt;

nbsp;

checklogin.asp
lt;%
dim strEmail
if Request.QueryString("Cookie") = 1 then
nbsp; nbsp; strEMail = Request.Cookies("SavedLogin")("Email")
else
nbsp; nbsp; strEMail = Request.Form("email")
end if

dim bLoginSaved

if Request.Form("SaveLogin") = "on" then
nbsp; nbsp; Response.Cookies("SavedLogin")("EMail") = Request("email")
nbsp; nbsp; Response.Cookies("SavedLogin")("pw") = Request("password")
nbsp; nbsp; Response.Cookies("SavedLogin").Expires = Date + 30
nbsp; nbsp; bLoginSaved = True
else
nbsp; nbsp; bLoginSaved = False
end if
%gt;

lt;htmlgt;
lt;headgt;

lt;titlegt;精彩春风之登录验证lt;/titlegt;

lt;/headgt;
lt;bodygt;

lt;% if bLoginSaved then %gt;
nbsp; nbsp; 将登录信息保存到Cookie里去lt;HRgt;
lt;% end if %gt;
欢迎光临随风起舞!lt;Pgt;

lt;% if Request.QueryString("Cookie") = 1 then %gt;
nbsp; nbsp; 保存成功!lt;Pgt;
lt;% end if %gt;
请确认您的电子邮件: lt;% = strEMail %gt;
lt;/bodygt;lt;/htmlgt;

(编辑:大同站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读