login.asp

Upload User: gufengji9
Upload Date: 2007-04-27
Package Size: 769k
Code Size: 4k
Category: Applications
Development Platform: PHP
  1. <!-- #include file="../data/CONN2.asp" -->
  2. <!-- #include file="isOK.asp" -->
  3. <%
  4. Dim gvName, gvPass, txt, tpCookies
  5. gvName=request.form("gvName")
  6. gvPass=request.form("gvPass")
  7. if Request.Form("tpCookies")="1" then
  8. tpCookies=dateadd("d",365,date())
  9. end if
  10. if request.form("action")="确定" then
  11. Dim GloginTry2
  12. Dim loginTry2 
  13. GloginTry2 = 5
  14. if isNull(Request.Cookies("loginTry2")) or Request.Cookies("loginTry2") = "" then
  15. Response.Cookies("loginTry2") = "1"
  16. else
  17. Response.Cookies("loginTry2") = CStr(Cint(Request.Cookies("loginTry2"))+1)
  18. end if
  19. loginTry2 = Cint(Request.Cookies("loginTry2")) 
  20. 'Response.Cookies("loginTry2") = "1"
  21. 'Response.write CStr(Cint(Request.Cookies("loginTry2"))+1)
  22. if loginTry2 > GloginTry2 then
  23. Response.write(prtCen("您登陆尝试次数过多,账户临时锁定!<Br><Br>"&_
  24. "如果问题依然不能解决,请联系在线勤杂工协助解决!<Br><Br>再次感谢您对 "&GAMVAN(0)&" 的支持<Br><Br>"&_
  25. "<a href=""javascript:history.back()"">返回上一页</a>"))
  26. Response.End()
  27. end if
  28. Sub isTimesOut(txt) 
  29. Dim loginTry2
  30. loginTry2 = Cint(Request.Cookies("loginTry2"))
  31. txt = txt & "<bR>您总共可以尝试:" &CStr(GloginTry2)&" 次<br>你现在还可以尝试:"&CStr(GloginTry2 -loginTry2)
  32. txt = txt & " 次"
  33. Response.write(prtCen(txt))
  34. Response.End()
  35. end Sub 
  36. '============================================================
  37. if Cint(Request.Form("tpNUM")) <> session("tpNUM") then
  38. Call isOK("<a href=""login.asp"">请正确输入验证码</a>")
  39. Response.End()
  40. end if
  41. Set rs=server.createobject("adodb.recordset")
  42.     rs.open"select userOP.*, users.pass from userOP INNER JOIN users on userOP.uoUserName=users.username where userOP.uoGradeID <= 2 and userOP.uoUserName='"&gvName&"' and users.pass='"&MD5(gvPass)&"'",conn,1,1
  43. on error resume next
  44. if not rs.eof then
  45. gvName=rs("opname")
  46. Response.Cookies(gvAdmin(1)) = gvName
  47. Response.Cookies(gvAdmin(2)) = gvPass
  48. Response.Cookies(gvAdmin(0)) = rs("uoIsOK")
  49. Response.Cookies(gvAdmin(3)) = rs("uoGradeID")
  50. 'Response.Write(rs("uoGradeID"))
  51. 'Response.End()
  52. Response.Cookies(gvAdmin(1)).expires = tpCookies
  53. Response.Cookies(gvAdmin(2)).expires = tpCookies
  54. Response.Cookies(gvAdmin(0)).expires = tpCookies
  55. Response.Cookies(gvAdmin(3)).expires = tpCookies
  56. Session(gvAdmin(1)) = Request.Cookies(gvAdmin(1))
  57. Session(gvAdmin(2)) = Request.Cookies(gvAdmin(2))
  58. Session(gvAdmin(0))=Response.Cookies(gvAdmin(0))
  59. Session(gvAdmin(3))=Response.Cookies(gvAdmin(3))
  60. Response.Cookies("loginTry2") = "1"
  61. ok 
  62. else
  63. Call isTimesOut("密码错误")
  64. txt="密码错误"
  65. login
  66. end if
  67. else
  68. login
  69. end if %><html><head>
  70. <title>管理员登陆</title>
  71. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  72. </head>
  73. <!--#include file="css.asp"-->
  74. <body bgcolor="#FFFFee" text="#000000" alink="#FFCCCC">
  75. <% function login %>
  76. <table width="100%" border="0">
  77. <form action="" method="post" name="form1">
  78. <tr><td colspan="2" align="center">〓〓〓<b><font color="#CC3300">总管理员登陆页面</font></b>〓〓〓</td>
  79.     </tr>
  80.     <tr> 
  81.       <td width="40%" height="22" align="right"> 名字: 
  82.       </td>
  83.       <td><input type="text" name="gvName" size="20" maxlength="20"></td>
  84.     </tr>
  85.     <tr> 
  86.       <td height="22" align="right"> 密码: 
  87.       </td>
  88.       <td><input type="password" name="gvPass" size="20" maxlength="20">
  89.         <% response.write(txt) %></td>
  90.     </tr>
  91.     <tr>
  92.       <td height="22" align="right">验证码:</td>
  93.       <td><input name="tpNUM" type="text" id="tpNUM" size="10" maxlength="10">
  94. <img src="../inc/xbm.asp">
  95.   </td>
  96.     </tr>
  97.     <tr>
  98.       <td height="22" align="right">是否纪录:</td>
  99.       <td>
  100.   <input name="tpCookies" type="radio" value="0" checked>不纪录
  101. &nbsp;&nbsp;&nbsp;
  102.       <input type="radio" name="tpCookies" value="1">记住登陆信息</td>
  103.     </tr>
  104.     <tr> 
  105.       <td>&nbsp; 
  106.       </td>
  107.       <td><input type="submit" name="action" value="确定">
  108.         <input type="reset" name="Submit2" value="重写"></td>
  109.     </tr>
  110.     <tr>
  111.       <td align="center">&nbsp;</td>
  112.       <td>闲人误闯</td>
  113.     </tr>
  114.   </form>
  115. </table>
  116. <% end function %>
  117. </body>
  118. </html> 
  119. <% function OK %>
  120. <div align="center"><a href="index.asp" target="_parent">登陆成功,您可以进行管理了!</a> </div>
  121. <% end function %>