< %@ Language=VBScript %>
< % option explicit %>
< % Response.buffer = true %>
< !-- #INCLUDE FILE="ASPSecurity.inc" -->
< %
dim aSignon
dim aPassword
dim dataValidated
dataValidated = false
' 檢查瀏覽器是否支援Cookies
Session("SupportsCookies") = (instr(1, Request.ServerVariables
("HTTP_COOKIE"), "ASPSESSIONID", vbTextCompare) > 0)
if Request("Action") = "登入" then
aSignon = lcase(trim(Request.Form("Signon")))
aPassword = lcase(trim(Request.Form("Password")))
if len(aSignon) = 0 then
Session("msg") = "請輸入使用者名稱字."
end if
if len(aPassword) = 0 then
Session("msg") = "請輸入密碼."
else
dataValidated=true
end if
if dataValidated then
if signUserOn(aSignon, aPassword) then
' 使用者身份被證實,允許進入受保護頁面
Response.Redirect "signedOn.asp?ID=" & Session("ID")
end if
end if
elseif Request("Action") = "註冊" then
Response.Redirect "register.asp"
end if
%>
function getID() dim numbers
dim letters
dim I
dim ID
Randomize
numbers="0123456789"
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for I = 1 to 10
if I mod 2 <> 0 then
ID = ID & mid(letters, Int((26 * Rnd) + 1),1)
else
ID = ID & mid(numbers, Int((10 * Rnd) + 1),1)
end if
next
getID = ID
end function