asp

位置:IT落伍者 >> asp >> 浏览文章

ASP实现记住密码的功能


发布日期:2022年12月20日
 
ASP实现记住密码的功能

把以下代码加入验证页
<%ifTrim(Cstr(requestQueryString("check")))="true"then‘用来判断是否有选择记住密码
ResponseCookies("UserCookie")("username")=Trim(Cstr(requestForm("username")))
ResponseCookies("UserCookie")("passwords")=trim(requestForm("passwords"))
’ResponseCookies("UserCookie")Path="/loginasp"
ResponseCookies("UserCookie")Expires=DateAdd("y"Now())
endif%>

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

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

上一篇:ASP的常用的自定义函数大全

下一篇:ASP函数:移除HTML代码