<!--#include file="conn.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/jle_fuction.asp"-->

<%
Dim kqiqi_checkcode,GetCode	
kqiqi_checkcode=CStr(session("GetCode"))
session("GetCode")=""
if kqiqi_checkcode<>CStr(request("kqiqi_checkcode"))  then
Response.write"<script>alert(""验证码不正确，请刷新后重写！  "");history.back();</script>"
Response.end
end if
dim username,password,rs,sql,k,jle_checkcode
if request.cookies("adminjle")("errs")="" then
k=0
else
k=request.cookies("adminjle")("errs")
end if
if request.cookies("adminjle")("errs")>5 then
response.write"<br>您输入的密码错误次数太多，系统保护中。"
response.end
end if
username=replace(trim(request("username")),"'","‘")
password=md5(replace(trim(request("password")),"'","‘"))
CheckCode=replace(trim(Request("CheckCode")),"'","")
if UserName="" then
response.write"<script language=JavaScript>" & chr(13) & "alert('用户名不能为空！');" & "history.back()" & "</script>"
response.end
end if
if Password="" then
response.write"<script language=JavaScript>" & chr(13) & "alert('密码不能为空！');" & "history.back()" & "</script>"
response.end
end if
chkjle(username)
if nothaveChinese(username)=false then
response.write"<br>用户名不能是中文。"
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 rs.eof then
Response.cookies("adminjle")("errs")=k+1
response.write"<br>您输入的密码错误。"
Response.Redirect "admin_login.asp"
response.end
else
Response.cookies("adminjle")("username")=rs("username")
Response.cookies("adminjle")("max")=rs("max")
Response.cookies("adminjle")("domain")=Request.ServerVariables("SERVER_NAME")
end if
rs.close
set rs=nothing
closedb
Response.Redirect "admin_index.asp"
%>