<!--#include file=conn.asp-->
<!--#include file=../md5.asp-->
 <link href="Style.css" rel="stylesheet" type="text/css">
 <LINK href="images/fox.css" rel=stylesheet></LINK>
<%
	dim sql
	dim rs
	dim username
	dim password,sheng,shi
	username=replace(trim(request("username")),"'","‘")
	sheng=replace(trim(request("sheng")),"'","‘")
	shi=replace(trim(request("shi")),"'","‘")
	password=md5(replace(trim(request("password")),"'","‘"))
	
   'session("fox_querr")=0
	if session("fox_querr")="" then
	session("fox_querr")=0
	else
	if session("fox_querr")>=30 then '错误次数设置
	response.write " <script LANGUAGE='javascript'>alert('你已经被锁定，请不要尝试非法登陆！');history.go(-1);</script>"
	response.end
	end if
	end if
	if trim(request("username"))="" or trim(request("password"))="" then
	response.write "<script LANGUAGE='javascript'>alert('账号密码为空！');history.go(-1);</script>"
	response.end
	end if
	if trim(request("sheng"))=0 or trim(request("shi"))=0 then
	response.write "<script LANGUAGE='javascript'>alert('您在哪个地区的管理？！');history.go(-1);</script>"
	response.end
	end if

if cstr(session("getcode"))<>cstr(trim(request("verifycode"))) then
response.Write "<script LANGUAGE='javascript'>alert('请输入正确的验证码！');history.go(-1);</script>"
response.end
end if
	

	set rs=server.createobject("adodb.recordset")
	sql="select * from [FOX_geadmin] where adpass='"&Password&"' and adname='"&UserName&"' and sheng="&sheng&" and shi="&shi&""
	rs.open sql,conn,1,1
 	if not rs.bof and not rs.eof then
 		if password=rs("adpass") then
        Response.cookies("foxwww")("diqu")=rs("adname")
        Response.cookies("foxwww")("fox")=now()
        session("admin_sheng")=rs("sheng")
        session("admin_shi")=rs("shi")
        Response.cookies("fox")("domain")=Request.ServerVariables("SERVER_NAME")
		Response.Redirect "index.asp"
 		else
            session("fox_querr")=session("fox_querr")+1
            response.write "<script LANGUAGE='javascript'>alert('身份确认失败，请重新登录！');history.go(-1);</script> "  
            response.end
 		end if
	else
            session("fox_querr")=session("fox_querr")+1
            response.write "<script LANGUAGE='javascript'>alert('身份确认失败，请重新登录！');history.go(-1);</script> "            
            response.end
	end if
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
%>