< %@ 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