<%@language=vbscript codepage=936 %> <% dim sql,rs dim username,password,CookieDate username=replace(trim(request("username")),"'","") password=replace(trim(Request("password")),"'","") CookieDate=trim(request("CookieDate")) dim ComeUrl ComeUrl=trim(request("ComeUrl")) if ComeUrl="" then ComeUrl=Request.ServerVariables("HTTP_REFERER") if ComeUrl="" then ComeUrl="index.asp" end if end if if UserName="" then FoundErr=True ErrMsg=ErrMsg & "
  • 用户名不能为空!
  • " end if if Password="" then FoundErr=True ErrMsg=ErrMsg & "
  • 密码不能为空!
  • " end if if CookieDate="" then CookieDate=0 else CookieDate=Clng(CookieDate) end if if FoundErr<>True then password=md5(password) set rs=server.createobject("adodb.recordset") sql="select * from " & db_User_Table & " where " & db_User_Name & "='" & username & "' and " & db_User_Password & "='" & password &"'" rs.open sql,Conn_User,1,3 if rs.bof and rs.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 用户名或密码错误!!!
  • " else if password<>rs(db_User_Password) then FoundErr=True ErrMsg=ErrMsg & "
  • 用户名或密码错误!!!
  • " else if rs(db_User_UserLevel)>999 then FoundErr=True ErrMsg=ErrMsg & "
  • 对不起,你尚未通过认证,不能登录!
  • " else rs(db_User_LastLoginIP)=Request.ServerVariables("REMOTE_ADDR") rs(db_User_LastLoginTime)=now() rs(db_User_LoginTimes)=rs(db_User_LoginTimes)+1 rs.update call SaveCookie_asp163() rs.close set rs=nothing call CloseConn_User() response.redirect ComeUrl end if end if end if rs.close set rs=nothing end if if FoundErr=True then call WriteErrMsg() end if call CloseConn_User() sub SaveCookie_asp163() Response.Cookies("asp163")("UserName")=username Response.Cookies("asp163")("Password") = PassWord Response.Cookies("asp163")("UserLevel")=rs("UserLevel") if UserTableType="Dvbbs6.0" then Response.Cookies("aspsky")("username") = username Response.Cookies("aspsky")("password") = PassWord Response.Cookies("aspsky")("userclass") = rs("userclass") Response.Cookies("aspsky")("userid") = rs("userid") Response.Cookies("aspsky")("userhidden") = 2 Response.Cookies("aspsky")("usercookies") = CookieDate elseif UserTableType="Dvbbs6.1" then Response.Cookies("aspsky")("username") = username Response.Cookies("aspsky")("password") = PassWord Response.Cookies("aspsky")("userclass") = rs("userclass") Response.Cookies("aspsky")("userid") = rs("userid") Response.Cookies("aspsky")("userhidden") = 2 Response.Cookies("aspsky")("usercookies") = CookieDate end if Response.Cookies("asp163")("CookieDate") = CookieDate select case CookieDate case 0 'not save case 1 Response.Cookies("asp163").Expires=Date+1 case 2 Response.Cookies("asp163").Expires=Date+31 case 3 Response.Cookies("asp163").Expires=Date+365 end select end sub '**************************************************** '过程名:WriteErrMsg '作 用:显示错误提示信息 '参 数:无 '**************************************************** sub WriteErrMsg() dim strErr strErr=strErr & "错误信息" & vbcrlf strErr=strErr & "" & vbcrlf strErr=strErr & "" & vbcrlf strErr=strErr & " " & vbcrlf strErr=strErr & " " & vbcrlf strErr=strErr & " " & vbcrlf strErr=strErr & "
    错误信息
    产生错误的可能原因:
    " & errmsg &"
    << 返回登录页面
    " & vbcrlf strErr=strErr & "" & vbcrlf response.write strErr end sub %>