Login.asp
上传用户:angela
上传日期:2022-05-11
资源大小:853k
文件大小:13k
源码类别:

外挂编程

开发平台:

ASP/ASPX

  1. <!--#include file="setup.asp"-->
  2. <!--#include file="Inc/Md5.asp"-->
  3. <%
  4. '=====================================================================
  5. ' 作者声明:转载请保留版权信息,鄙视不要脸的人
  6. '=====================================================================
  7. ' 程序名称:蓝宇网络发布系统
  8. ' 程序作者:蓝宇 QQ:18159079 ╲、随心゛ QQ:6821845
  9. ' 文件名称:Login.asp
  10. ' 更新日期:2007-6-5
  11. '=====================================================================
  12. ' 联系方式:Tel:13203117383,QQ:18159079,hi.baidu.com/hezeyu
  13. ' 程序开发:蓝宇,╲、随心゛
  14. ' 官方网站:蓝宇网络(http://hi.baidu.com/hezeyu)
  15. '=====================================================================
  16. ' Copyright 2004-2007 蓝宇 - All Rights Reserved.
  17. '=====================================================================
  18. Response.CacheControl = "no-cache"
  19. Dim loginok, RefreshTime, GetCode
  20. FoundErr = False
  21. loginok = 0         '是否开启登陆提示,1=开启,0=关闭
  22. RefreshTime = 3     '设置防刷新时间
  23. If DateDiff("s", Session("UserTime"), Now()) < RefreshTime Then
  24.     Response.Write "<META http-equiv=Content-Type content=text/html; chaRset=gb2312><meta HTTP-EQUIV=REFRESH CONTENT="&RefreshTime&"><br>本页面起用了防刷新机制,请不要在"&RefreshTime&"秒内连续刷新本页面<BR>正在打开页面,请稍后……"
  25.     Response.End
  26. End If
  27. FoundErr = False
  28. Select Case tee5.CheckStr(Request("action"))
  29.   Case "logout" '退出系统
  30.     Call logout()
  31.   Case "login" '登陆系统
  32.     Call chklogin()
  33.   Case Else
  34.     Call main()
  35. End Select
  36. If Founderr = True Then
  37.     Session("UserTime") = Now()
  38.     Response.Redirect("showerr.asp?action=error&message=" & Server.URLEncode(ErrMsg) & "")
  39. End If
  40. CloseConn
  41. Sub main()
  42.     If Session("LoginName") = "" Then
  43.     Response.Write "<html>"
  44.     Response.Write "<head>"
  45.     Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
  46.     Response.Write "<title>管理员登陆 - " & tee5.WebName & " - 诛仙私服</title>"
  47.     Response.Write "<LINK href=""Images/Style.css"" type=text/css rel=stylesheet>"
  48.     Response.Write "</head>"
  49.     Response.Write "<script language=""javascript"">" & vbCrLf
  50.     Response.Write "<!--//" & vbCrLf
  51.     Response.Write "function SetFocus()" & vbCrLf
  52.     Response.Write "{" & vbCrLf
  53.     Response.Write "if (document.myform.LoginName.value=="""")" & vbCrLf
  54.     Response.Write "document.myform.LoginName.focus();" & vbCrLf
  55.     Response.Write "else" & vbCrLf
  56.     Response.Write "document.myform.LoginName.select();" & vbCrLf
  57.     Response.Write "}" & vbCrLf
  58.     Response.Write "function CheckForm()" & vbCrLf
  59.     Response.Write "{" & vbCrLf
  60.     Response.Write "if(document.myform.LoginName.value=="""")" & vbCrLf
  61.     Response.Write "{" & vbCrLf
  62.     Response.Write "alert(""请输入您的用户名!"");" & vbCrLf
  63.     Response.Write "document.myform.LoginName.focus();" & vbCrLf
  64.     Response.Write "return false;" & vbCrLf
  65.     Response.Write "}" & vbCrLf
  66.     Response.Write "if(document.myform.password.value == """")" & vbCrLf
  67.     Response.Write "{" & vbCrLf
  68.     Response.Write "alert(""请输入您的密码!"");" & vbCrLf
  69.     Response.Write "document.myform.password.focus();" & vbCrLf
  70.     Response.Write "return false;" & vbCrLf
  71.     Response.Write "}" & vbCrLf
  72.     If IsAdminValidate Then
  73.     Response.Write "if(document.myform.validate.value == """")" & vbCrLf
  74.     Response.Write "{" & vbCrLf
  75.     Response.Write "alert(""请输入您的认证码!"");" & vbCrLf
  76.     Response.Write "document.myform.validate.focus();" & vbCrLf
  77.     Response.Write "return false;" & vbCrLf
  78.     Response.Write "}" & vbCrLf
  79.     End If
  80.     Response.Write "if (document.myform.verifycode.value==""""){" & vbCrLf
  81.     Response.Write "alert (""请输入您的验证码!"");" & vbCrLf
  82.     Response.Write "document.myform.verifycode.focus();" & vbCrLf
  83.     Response.Write "return(false);" & vbCrLf
  84.     Response.Write "}" & vbCrLf
  85.     Response.Write "}" & vbCrLf
  86.     Response.Write "function CheckBrowser()" & vbCrLf
  87.     Response.Write "{" & vbCrLf
  88.     Response.Write "var app=navigator.appName;" & vbCrLf
  89.     Response.Write "var verStr=navigator.appVersion;" & vbCrLf
  90.     Response.Write "if (app.indexOf('Netscape') != -1) {" & vbCrLf
  91.     Response.Write "alert(""126诛仙私服友情提示:n    你使用的是Netscape浏览器,可能会导致无法使用后台的部分功能。建议您使用 IE6.0 或以上版本。"");" & vbCrLf
  92.     Response.Write "}" & vbCrLf
  93.     Response.Write "else if (app.indexOf('Microsoft') != -1) {" & vbCrLf
  94.     Response.Write "if (verStr.indexOf(""MSIE 3.0"")!=-1 || verStr.indexOf(""MSIE 4.0"") != -1 || verStr.indexOf(""MSIE 5.0"") != -1 || verStr.indexOf(""MSIE 5.1"") != -1)" & vbCrLf
  95.     Response.Write "alert(""126诛仙私服友情提示:n    您的浏览器版本太低,可能会导致无法使用后台的部分功能。建议您使用 IE6.0 或以上版本。"");" & vbCrLf
  96.     Response.Write "}" & vbCrLf
  97.     Response.Write "}" & vbCrLf
  98.     Response.Write "//-->" & vbCrLf
  99.     Response.Write "</script>"
  100.     Response.Write "<body topmargin=""0"" leftmargin=""0"" rightmargin=""0"">"
  101.     Response.Write "<p>&nbsp;</p>"
  102.     Response.Write "<p>&nbsp;</p>"
  103.     Response.Write "<table border=""0"" align=center cellpadding=""1"" cellspacing=""0"" bgcolor=""#FFFFFF"" style=""border: outset 3px;width:0;"">"
  104.     Response.Write "<form name=myform method=""post"" action=""?action=login"" target=""_top"" onSubmit=""return CheckForm();"">"
  105.     Response.Write "<tr>"
  106.     Response.Write "<td><table width=""605"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">"
  107.     Response.Write "<tr>"
  108.     Response.Write "<td colspan=""3"" height=""17"" background=""images/admin_login_r1_c1.jpg""></td>"
  109.     Response.Write "</tr>"
  110.     Response.Write "<tr>"
  111.     Response.Write "<td width=""24"" valign=""top""><img src=""images/admin_login_r2_c1.jpg"" width=""23"" height=""212""></td>"
  112.     Response.Write "<td width=""494"" align=""center"" valign=""top"" bgcolor=""#FFFFFF"">"
  113.     Response.Write "<table width=""100%"" height=""100""  border=""0"" cellpadding=""0"" cellspacing=""0"">"
  114.     Response.Write "<tr>"
  115.     Response.Write "<td align=""right"" valign=""bottom"" background=""images/admin_login_r2_c2.jpg"" height=""100""></td>"
  116.     Response.Write "</tr>"
  117.     Response.Write "</table>"
  118.     If IsAdminValidate Then
  119.     Response.Write "<table width=""100%""  border=""0"" align=""center"" cellpadding=""0"" cellspacing=""1"">"
  120.     else
  121.     Response.Write "<table width=""100%""  border=""0"" align=""center"" cellpadding=""0"" cellspacing=""6"">"
  122.     End If
  123.     Response.Write "<tr>"
  124.     Response.Write "<td width=""78%"" align=""left"">用户名: <input name=""LoginName"" type=""text"" size=""25"" style=""background-color: #F8F8F8;""></td>"
  125.     Response.Write "</tr>"
  126.     Response.Write "<tr>"
  127.     Response.Write "<td align=""left"">密 码: <input name=""password"" type=""password"" size=""25"" style=""background-color: #F8F8F8;""></td>"
  128.     Response.Write "</tr>"
  129.     If IsAdminValidate Then
  130.     Response.Write "<tr>"
  131.     Response.Write "<td align=""left"">认证码: <input name=""validate"" type=""password"" size=""25"" style=""background-color: #F8F8F8;""></td>"
  132.     Response.Write "</tr>"
  133.     End If
  134.     Response.Write "<tr>"
  135.     Response.Write "<td align=""left"">附加码: <input name=""verifycode"" type=""text"" size=""8"" maxlength=""4"" value="""
  136.     If GetCode=9999 Then Response.Write "9999"
  137.     Response.Write """ style=""background-color: #F8F8F8;""> "
  138.     Response.Write " 请在附加码框输入 <img src=""inc/Gqcode.asp"" alt=""验证码,看不清楚?请点击刷新验证码"" height=""10"" style=""cursor : pointer;"" onclick=""this.src='inc/Gqcode.asp'"" /></td>"
  139.     Response.Write "</tr>"
  140.     Response.Write "<tr>"
  141.     Response.Write "<td align=""left"">"
  142.     Response.Write "<input type='hidden' name='Action' value='Login'>"
  143.     Response.Write "<input type=""submit"" name=""Submit"" value=""登陆系统"" class=button>&nbsp;&nbsp;"
  144.     Response.Write "<input onclick=window.location.reload() type=button value=刷新本页 name=refresh class=button>&nbsp;&nbsp;"
  145.     Response.Write "<input type=""button"" name=""Submit1"" onclick=""javascript:location.href='../'"" value=""返回首页"" class=button>"
  146.     Response.Write "</td>"
  147.     Response.Write "</tr>"
  148.     Response.Write "</table></td>"
  149.     Response.Write "<td width=""88"" valign=""top""><img src=""images/admin_login_r2_c3.jpg"" width=""88"" height=""212""></td>"
  150.     Response.Write "</tr>"
  151.     Response.Write "<tr>"
  152.     Response.Write "<td colspan=""3"" align=""center"" height=""21"" background=""images/admin_login_r4_c1.jpg""></td>"
  153.     Response.Write "</tr>"
  154.     Response.Write "</table></td>"
  155.     Response.Write "</tr>"
  156.     Response.Write "</form>"
  157.     Response.Write "</table>"
  158.     Response.Write "<script language=""JavaScript"">" & vbCrLf
  159.     Response.Write "<!--" & vbCrLf
  160.     Response.Write "CheckBrowser();" & vbCrLf
  161.     Response.Write "SetFocus();" & vbCrLf
  162.     Response.Write "-->" & vbCrLf
  163.     Response.Write "</script>"
  164.     Response.Write "<p align=center></p>"
  165.     Response.Write "</body>"
  166.     Response.Write "</html>"
  167.     Else
  168.     Response.Redirect "admin_index.asp"
  169.     End If
  170. End Sub
  171. Sub logout()
  172.     '清除COOKIES中管理员身份的验证信息.
  173.     'Session.Abandon
  174.     Session("LoginName") = ""
  175.     Session("AdminPass") = ""
  176.     Session("AdminGrade") = ""
  177.     Session("AdminFlag") = ""
  178.     Session("AdminStatus") = ""
  179.     Session("AdminID") = ""
  180.     Session("validate") = ""
  181.     Session("AdminRandomCode") = ""
  182.     Response.Cookies(Admin_Cookies_Name) = ""
  183.     Response.Redirect ("../")
  184. End Sub
  185. Sub chklogin()
  186.     Dim LoginName, password, RandomCode
  187.     LoginName = tee5.CheckBadstr(Request("LoginName"))
  188.     password = md5(Trim(Replace(Request("password"), "'", "")))
  189.     RandomCode = tee5.CheckBadstr(Request("RandomCode"))
  190.     If tee5.CheckPost = False Then
  191.         ErrMsg = ErrMsg + "您提交的数据不合法,请不要从外部提交登陆!!!"
  192.         Founderr = True
  193.     End If
  194.     If IsValidStr(Request("LoginName")) = False Then
  195.         ErrMsg = ErrMsg + "<li>用户名中含有非法字符!</li>"
  196.         Founderr = True
  197.     End If
  198.     If IsValidPassword(Request("password")) = False Then
  199.         ErrMsg = ErrMsg + "<li>密码中含有非法字符!</li>"
  200.         Founderr = True
  201.     End If
  202.     If IsAdminValidate Then
  203.         If Trim(Request.Form("validate")) <> AdminValidateCode Or Trim(Request.Form("validate")) = "" Then
  204.             ErrMsg = ErrMsg+"<li>您输入的认证码不正确,请重新输入!</li>"
  205.             Founderr = true
  206.         Exit Sub
  207.         End if
  208.     End If
  209.     If Request("verifycode") = "" Then
  210.         ErrMsg = ErrMsg + "<br>" + "<li>请返回输入确认码!</li>"
  211.         Founderr = True
  212.     ElseIf Session("getcode") = "9999" Then
  213.         Session("getcode") = ""
  214.         ErrMsg = ErrMsg + "<br>" + "<li>请不要重复提交,如需重新登陆请返回登陆页面!</li>"
  215.         Founderr = True
  216.     ElseIf CStr(Session("getcode"))<>CStr(Trim(Request("verifycode"))) Then
  217.         ErrMsg = ErrMsg + "<br>" + "<li>您输入的验证码与系统产生的不一致,请重新输入!</li>"
  218.         Founderr = True
  219.     End If
  220.         Session("getcode") = ""
  221.     If LoginName = "" Or password = "" Then
  222.         Founderr = True
  223.         ErrMsg = ErrMsg + "<br>" + "<li>请输入您的用户名或密码。</li>"
  224.         Exit Sub
  225.     End If
  226.     If Founderr = True Then Exit Sub
  227.         If Not IsObject(Conn) Then ConnectionDatabase
  228.         Set Rs = Server.CreateObject("ADODB.Recordset")
  229.         SQL = "SELECT * FROM Gq_Admin WHERE AdminName='" & LoginName & "'"
  230.         Rs.Open SQL, Conn, 1, 3
  231.         If Rs.BOF And Rs.EOF Then
  232.             FoundErr = True
  233.             ErrMsg = ErrMsg + "<li>您输入的用户名不正确!</li>"
  234.             Exit Sub
  235.         Else
  236.         If password <> Rs("password") Then
  237.             FoundErr = True
  238.             ErrMsg = ErrMsg + "<br><li>您输入的密码不正确!</li>"
  239.             Exit Sub
  240.         End If
  241.         If Rs("isLock") <> 0 Or Rs("isLock") = "" Then
  242.             Founderr = True
  243.             ErrMsg = "<li><font color=red>抱歉,您的帐号已被锁定!如要开通,请联系高级管理员!</font></li>"
  244.             Exit Sub
  245.         End If
  246.         End If
  247.         RandomCode = tee5.GetRandomCode
  248.         Rs("LoginTime") = Now()
  249.         Rs("Loginip") = tee5.GetUserip
  250.         Rs("RandomCode") = RandomCode
  251.         Rs.Update
  252.         If FoundErr = False Then
  253.             Session("LoginName") = Rs("AdminName")
  254.             Session("AdminPass") = Rs("password")
  255.             Session("AdminGrade") = Rs("AdminGrade")
  256.             Session("AdminFlag") = Rs("Authority")
  257.             Session("AdminStatus") = Rs("Status")
  258.             Session("AdminRandomCode") = RandomCode
  259.             Session("AdminID") = Rs("id")
  260.         If IsAdminValidate Then
  261.             Session("validate") = Trim(Request.Form("validate"))
  262.         End If
  263.         If UseAdminCookies Then
  264.             Response.Cookies(Admin_Cookies_Name)("LoginName") = Rs("AdminName")
  265.             Response.Cookies(Admin_Cookies_Name)("AdminPass") = Rs("password")
  266.             Response.Cookies(Admin_Cookies_Name)("AdminGrade") = Rs("AdminGrade")
  267.             Response.Cookies(Admin_Cookies_Name)("AdminFlag") = Rs("Authority")
  268.             Response.Cookies(Admin_Cookies_Name)("AdminStatus") = Rs("Status")
  269.             Response.Cookies(Admin_Cookies_Name)("RandomCode") = RandomCode
  270.             Response.Cookies(Admin_Cookies_Name)("AdminID") = Rs("ID")
  271.         If IsAdminValidate Then
  272.             Response.Cookies(Admin_Cookies_Name)("validate") = Trim(Request.Form("validate"))
  273.         End If
  274.         End If
  275.     End If
  276.     Rs.Close
  277.     Set Rs = Nothing
  278.     Response.Redirect ("admin_Index.asp")
  279. End Sub
  280. %>