<!--#include file="inc/function.asp"-->
 <%
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("../sq_50tp.asp")
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
username=Checkin(trim(Request.form("username")))
password=Checkin(trim(Request.form("password")))
VCode=Checkin(trim(Request.form("VCode")))
if username="" then
	errmsg="用户名没有输入！"
		call error()
	Response.End 
end if
 if   password="" then
errmsg="密码没有输入！"
	call error()
	Response.End 
end if


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("Adminname")=rs("username")
	Session("IsAdmin")=true
	Session("KEY")=rs("oskey")
    Session.timeout=900
	Response.Redirect ("admin.asp")
else
	errmsg="管理员帐户或密码出错！"
	call error()
	Response.End 
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>