把以下代碼加入驗證頁:
<%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")
%>