login.htm
<% @ Language=javascript %>
<%
if (Request.Cookies("SavedLogin").HasKeys) {
Response.Redirect("checklogin.asp?Cookie=1")
}
%>
<html>
<head>
<title>精彩春風之登入頁面</title>
</head>
<body>
我要登入隨風起舞
<FORM ACTION="CheckLogin.asp" METHOD="POST">
電子郵件: <INPUT TYPE="Text" NAME="email" SIZE="40"><BR>
口令: <INPUT TYPE="Password" NAME="Password" SIZE="40"><P>
<INPUT TYPE="Checkbox" NAME="SaveLogin"> 要把登入內容存為Cookie嗎?<P>
<INPUT TYPE="Submit" VALUE="登入"><INPUT TYPE="RESET">
</FORM>
checklogin.asp
<%
dim strEmail
if Request.QueryString("Cookie") = 1 then
strEMail = Request.Cookies("SavedLogin")("Email")
else
strEMail = Request.Form("email")
end if
dim bLoginSaved
if Request.Form("SaveLogin") = "on" then
Response.Cookies("SavedLogin")("EMail") = Request("email")
Response.Cookies("SavedLogin")("pw") = Request("password")
Response.Cookies("SavedLogin").Expires = Date + 30
bLoginSaved = True
else
bLoginSaved = False
end if
%>
<html>
<head>
<title>精彩春風之登入驗證</title>
</head>
<body>
<% if bLoginSaved then %>
將登入資訊儲存到Cookie裡去<HR>
<% end if %>
歡迎光臨隨風起舞!<P>
<% if Request.QueryString("Cookie") = 1 then %>
儲存成功!<P>
<% end if %>
請確認您的電子郵件: <% = strEMail %>
</body></html>