Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--#include file="conn.asp"-->
- <!--#include file="function.asp"-->
- <%
- username=Checkin(trim(Request.form("username")))
- password=Checkin(trim(Request.form("password")))
- if username="" or password="" then Response.Redirect ("index.asp")
- set rs=server.createobject("adodb.recordset")
- sql="select * from admin where username='"&username&"'and password='"&password&"'"
- rs.open sql,conn,1,3
- if not rs.EOF then
- rs("LoginTimes")=rs("LoginTimes")+1
- rs("LoginTime")=now()
- rs("LoginIP")=Request.ServerVariables("REMOTE_ADDR")
- rs.Update
- Session("AdminID")=rs("id")
- Session("IsAdmin")=true
- Session("KEY")=rs("oskey")
- Session.timeout=900
- Response.Redirect ("admin.asp")
- else
- errmsg="please input correct name and password!"
- call error()
- Response.End
- end if
- rs.close
- set rs=nothing
- conn.close
- set conn=nothing
- %>
- <!--"conn.asp" -->
- <%
- dim conn
- dim dbpath
- set conn=server.createobject("adodb.connection")
- DBPath = Server.MapPath("../Music.mdb") <!--database name-->
- conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
- %>
- <!-- "function.asp"-->
- <%
- function Checkin(s)
- s=trim(s)
- s=replace(s," "," ")
- s=replace(s,"'","'")
- s=replace(s,"""",""")
- s=replace(s,"<","<")
- s=replace(s,">",">")
- Checkin=s
- end function
- function CheckAdmin1
- if Session("IsAdmin")<>true then response.redirect "error.asp"
- end function
- function CheckAdmin2
- if Session("IsAdmin")<>true or (session("KEY")<>"check" and session("KEY")<>"super") then response.redirect "error.asp"
- end function
- function CheckAdmin3
- if Session("IsAdmin")<>true or session("KEY")<>"super" then response.redirect "error.asp"
- end function
- sub error()
- %>
- <!--#include file="style.asp"-->
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <title>index</title>
- <!--#include file="style.asp"-->
- </head>
- <body topmargin="111" leftmargin="0">
- <div align="center">
- <center>
- <table border="0" cellspacing="0" width="60%">
- <tr>
- <td width="100%" bgcolor="#CC0066">
- <div align="center">
- <table border="0" cellpadding="0" cellspacing="0" width="100%">
- <tr>
- <td width="100%" bgcolor="#FFFFFF" height="80" align="center">
- <b>Error! <%=errmsg%>! :(</b>
- <p><b><a href="javascript:history.go(-1)">click here and return</a></b>
- </td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
- </table>
- </center>
- </div>
- </body>
- </html>
- <%
- end sub
- %>
Add Comment
Please, Sign In to add comment