ASP實現記住密碼的功能

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章