<!--#include file="pysjzx_conn.asp"-->
<!--#include file="../md5.asp"-->
<%
ServerName1=Cstr(Request.ServerVariables("HTTP_REFERER"))
ServerName2=Cstr(Request.ServerVariables("SERVER_NAME"))
If Mid(ServerName1,8,len(ServerName2))<>ServerName2 Then
    Response.Write "路径有误，禁止从网站外部提交表单！"
    response.end
End if
%>
<%
session.Timeout=100   '登陆超时时间(单位为分钟)
dim admin,password
admin=replace(trim(request("admin")),"'","")
password=md5(replace(trim(request("password")),"'",""))
passwordl=replace(trim(request("password")),"'","")

if request("verifycode")="" then
	response.write "<script LANGUAGE='javascript'>alert('请输入确认码！');history.go(-1);</script>"
	response.end
elseif session("verifycode")="" then
	response.write "<script LANGUAGE='javascript'>alert('请不要重复提交，如需重新登陆请返回登陆页面！');history.go(-1);</script>"
	response.end	
elseif session("verifycode")<>trim(request("verifycode")) then
	response.write "<script LANGUAGE='javascript'>alert('您输入的确认码有误，请重新输入！');history.go(-1);</script>"
	response.end
end if

uerip=request.servervariables("HTTP_X_FORWARDED_FOR")
if userip="" then
uerip=Request.serverVariables("REMOTE_ADDR")
end if


set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from admin where admin='"&admin&"' and password='"&password&"' " ,conn,1,3
if not(rs.bof and rs.eof) then
if password=rs("password") then
session("admin")=trim(rs("admin"))
session("flag")=int(rs("flag"))
adminid=int(rs("adminid"))
rs("logins")=rs("logins")+1
rs.update
rs.Close


set rs=server.CreateObject("adodb.recordset")
rs.open "select * from login" ,conn,1,3
rs.addnew
rs("admin")=admin
loings=rs("thislogin")
rs("ThisLogin")=logins+1
rs("logindate")=now()
rs("loginip")=uerip
rs("sort")=1
rs.update
rs.close


response.Redirect "index.asp"
else

set rs=server.CreateObject("adodb.recordset")
rs.open "select * from login" ,conn,1,3
rs.addnew
rs("admin")=admin
rs("password")=password1
loings=rs("thislogin")
rs("ThisLogin")=logins+1
rs("logindate")=now()
rs("loginip")=uerip
rs("sort")=2
rs.update
rs.close

response.Write "<script language=javascript>alert('登陆失败，你的信息已经被记录！');window.location.href='login.asp';</script>"
end if
else

set rs=server.CreateObject("adodb.recordset")
rs.open "select * from login" ,conn,1,3
rs.addnew
rs("admin")=admin
rs("password")=password1
rs("ThisLogin")=rs("ThisLogin")+1
rs("logindate")=now()
rs("loginip")=uerip
rs("sort")=2
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('登陆失败，你的信息已经被记录！');window.location.href='login.asp';</script>"
end if
%> 
  