Guest User

Untitled

a guest
Oct 2nd, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. <!--#include file="conn.asp"-->
  2. <!--#include file="function.asp"-->
  3.  
  4. <%
  5. username=Checkin(trim(Request.form("username")))
  6. password=Checkin(trim(Request.form("password")))
  7. if username="" or password="" then Response.Redirect ("index.asp")
  8.  
  9. set rs=server.createobject("adodb.recordset")
  10. sql="select * from admin where username='"&username&"'and password='"&password&"'"
  11. rs.open sql,conn,1,3
  12. if not rs.EOF then
  13. rs("LoginTimes")=rs("LoginTimes")+1
  14. rs("LoginTime")=now()
  15. rs("LoginIP")=Request.ServerVariables("REMOTE_ADDR")
  16. rs.Update
  17.  
  18. Session("AdminID")=rs("id")
  19. Session("IsAdmin")=true
  20. Session("KEY")=rs("oskey")
  21. Session.timeout=900
  22. Response.Redirect ("admin.asp")
  23. else
  24. errmsg="please input correct name and password!"
  25. call error()
  26. Response.End
  27. end if
  28. rs.close
  29. set rs=nothing
  30. conn.close
  31. set conn=nothing
  32. %>
  33.  
  34. <!--"conn.asp" -->
  35. <%
  36. dim conn
  37. dim dbpath
  38. set conn=server.createobject("adodb.connection")
  39. DBPath = Server.MapPath("../Music.mdb") <!--database name-->
  40. conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
  41. %>
  42.  
  43. <!-- "function.asp"-->
  44. <%
  45. function Checkin(s)
  46. s=trim(s)
  47. s=replace(s," ","&nbsp;")
  48. s=replace(s,"'","&#39;")
  49. s=replace(s,"""",""")
  50. s=replace(s,"<","<")
  51. s=replace(s,">",">")
  52. Checkin=s
  53. end function
  54. function CheckAdmin1
  55. if Session("IsAdmin")<>true then response.redirect "error.asp"
  56. end function
  57. function CheckAdmin2
  58. if Session("IsAdmin")<>true or (session("KEY")<>"check" and session("KEY")<>"super") then response.redirect "error.asp"
  59. end function
  60. function CheckAdmin3
  61. if Session("IsAdmin")<>true or session("KEY")<>"super" then response.redirect "error.asp"
  62. end function
  63.  
  64. sub error()
  65. %>
  66. <!--#include file="style.asp"-->
  67. <html>
  68. <head>
  69. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  70.  
  71. <title>index</title>
  72. <!--#include file="style.asp"-->
  73. </head>
  74. <body topmargin="111" leftmargin="0">
  75. <div align="center">
  76. <center>
  77. <table border="0" cellspacing="0" width="60%">
  78. <tr>
  79. <td width="100%" bgcolor="#CC0066">
  80. <div align="center">
  81. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  82. <tr>
  83. <td width="100%" bgcolor="#FFFFFF" height="80" align="center">
  84. <b>Error!&nbsp; <%=errmsg%>!&nbsp; :(</b>
  85. <p><b><a href="javascript:history.go(-1)">click here and return</a></b>
  86. </td>
  87. </tr>
  88. </table>
  89. </div>
  90. </td>
  91. </tr>
  92. </table>
  93. </center>
  94. </div>
  95. </body>
  96. </html>
  97. <%
  98. end sub
  99. %>
Add Comment
Please, Sign In to add comment