<% Response.Expires = -1 Response.ExpiresAbsolute = Now() - 1 Response.Expires = 0 Response.CacheControl = "no-cache" If Action = "Login" Then Call ChkLogin ElseIf Action = "Logout" Then Call Logout Else Call main End If If FoundErr = True Then Call WriteErrMsg End If Call CloseConn Sub main() %> <%=systemPageTitle%>
 
<%if useSiteManageCode = true then%> <% end if if useCheckCode = true then %> <%end if%>
用户名: 密 码: 系统验证码: 验证码:
 
<% end sub Sub ChkLogin() Dim sql, rs Dim UserName, Password, CheckCode, AdminLoginCode, RndPassword, voiceAlarm UserName = ReplaceBadChar(Trim(Request("UserName"))) Password = ReplaceBadChar(Trim(Request("Password"))) voiceAlarm = Trim(Request("voiceAlarm")) if useSiteManageCode = true then AdminLoginCode = Trim(Request("AdminLoginCode")) if useCheckCode = true then CheckCode = LCase(ReplaceBadChar(Trim(Request("CheckCode")))) If CSng(ScriptEngineMajorVersion & "." & ScriptEngineMinorVersion) < 5.6 Then FoundErr = True ErrMsg = ErrMsg & "
  • 服务器脚本解释引擎(VBScript)版本过低,请联系您的空间商或服务器管理员更新。
  • " ErrMsg = ErrMsg & "
  • 脚本解释引擎下载地址
  • " End If If UserName = "" Then FoundErr = True ErrMsg = ErrMsg & "
  • 用户名不能为空!
  • " End If If Password = "" Then FoundErr = True ErrMsg = ErrMsg & "
  • 密码不能为空!
  • " End If if useCheckCode = true then If CheckCode = "" Then FoundErr = True ErrMsg = ErrMsg & "
  • 您输入的随机验证码和系统产生的不一致,请重新输入。
  • " End If If Trim(Session("CheckCode")) = "" Then FoundErr = True ErrMsg = ErrMsg & "
  • 你在管理登陆停留的时间过长,导致验证码失效。请重新返回登陆页面进行登陆。
  • " End If If CheckCode <> Session("CheckCode") Then FoundErr = True ErrMsg = ErrMsg & "
  • 您输入的验证码和系统产生的不一致,请重新输入。
  • " End If end if if useSiteManageCode = true then If AdminLoginCode <> SiteManageCode Then FoundErr = True ErrMsg = ErrMsg & "
  • 您输入的系统验证码不对,请重新输入。
  • " End If end if If FoundErr = True Then Exit Sub End If ComeUrl = Trim(Request.ServerVariables("HTTP_REFERER")) Password = MD5(Password, 32) Set rs = Server.CreateObject("adodb.recordset") sql = "select * from t_user_info where pwd='" & Password & "' and uid='" & UserName & "'" rs.Open sql, Conn, 1, 3 If rs.bof And rs.EOF Then FoundErr = True ErrMsg = ErrMsg & "
  • 用户名或密码错误!!!
  • " Else If rs("status") = 1 then FoundErr = True ErrMsg = ErrMsg & "
  • 用户已被禁用!!!
  • " if useUserLog = true then Call WriteLog(UserName,"禁止登录") Exit Sub End If If Password <> rs("pwd") Then FoundErr = True ErrMsg = ErrMsg & "
  • 用户名或密码错误!!!
  • " End If End If If FoundErr = True Then Session("AdminName") = "" Session("AdminPassword") = "" Session("RndPassword") = "" rs.Close Set rs = Nothing Exit Sub End If RndPassword = GetRndPassword(16) rs("rndpassword") = RndPassword rs.Update Response.Cookies("AdminName") = rs("uid") Response.Cookies("AdminPassword") = rs("pwd") Response.Cookies("RndPassword") = RndPassword if useSiteManageCode = true then Response.Cookies("AdminLoginCode") = AdminLoginCode if voiceAlarm = "voiceAlarm" then Response.Cookies("voiceAlarm") = "on" else Response.Cookies("voiceAlarm") = "off" rs.Close Set rs = Nothing if useUserLog = true then Call WriteLog(UserName,"登录系统") Call CloseConn Response.Redirect "index.asp" End Sub Sub Logout() if useUserLog = true then Call WriteLog(trim(request.Cookies("AdminName")),"退出系统") Response.Cookies("AdminName") = "" Response.Cookies("AdminPassword") = "" Response.Cookies("RndPassword") = "" Response.Cookies("voiceAlarm") = "on" Call CloseConn Response.Redirect "login.asp" End Sub Sub WriteErrMsg() %> 错误信息 错误信息
    产生错误的可能原因:
    <%=ErrMsg%>

    << 返回登录页面 <% End Sub Sub WriteLog(uid,msg) conn.execute("insert into t_user_log (uid,happentime,contents) values ('"&uid&"','"&now()&"','"&msg&"')") End Sub %>