知识库

ASP实现记住密码的功能

来源: 本站    类别: 知识库    日期: 2010/5/13

 把以下代码加入验证页: 
<%if Trim(Cstr(request.QueryString("check")))="true" then ‘用来判断是否有选择记住密码 
Response.Cookies("UserCookie")("username") = Trim(Cstr(request.Form("username"))) 
Response.Cookies("UserCookie")("passwords") = trim(request.Form("passwords")) 
’Response.Cookies("UserCookie").Path = "/login.asp" 
Response.Cookies("UserCookie").Expires= DateAdd("y",1,Now()) 
end if%> 

登录页代码: 
//这段代码是用来判断是否有选择记住密码,同时也发送一个判断字段给后台 
<script type="text/javascript"> 
function check() 
{if(document.getElementById("checkbox").checked) 
alert(document.getElementById("checkbox").checked) 
document.getElementById("ddd").action=’check.asp?id=user&check=’+document.getElementById("checkbox").checked;} 
</script> 

‘以下代码是用来实现记住密码的功能 
<% 
strUsername=Request.Cookies("UserCookie")("username") 
strPassword=Request.Cookies("UserCookie")("passwords") 
%> 

相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com