<!--#include file="../conn.asp"-->
<!--#include file="../inc/md5.asp" -->
<%
username=trim(request.form("username"))
password=trim(request.form("password"))

for i=1 to len(username)
cl=mid(username,i,1)
if cl="'" or cl="<" or cl=">" or cl="%" or cl="/" or cl="-" or cl="#" or cl="or" then
   response.write "<script langugae=javascript>alert('请输入正确的用户名！');"
   response.write "window.location.href='../admin.asp';</script>"
   response.end   
end if
next

for i=1 to len(password)
pwd=mid(password,i,1)
if pwd="'" or pwd="<" or pwd=">" or pwd="%" or pwd="/" or pwd="#" or pwd="or" or pwd="-" then
   response.write "<script langugae=javascript>alert('密码中不能有非法字符！');"
   response.write "window.location.href='../admin.asp';</script>"
   response.end   
end if
next

If Not codepass and session("errorcount")>=3 Then
   response.write "<script language='javascript'>"
   response.write "alert('验证码错误，请刷新后重新输入！');"
   response.write "history.go(-1);"
   response.write "</script>"
   response.end 
End If

set rs=server.createobject("adodb.recordset")
str="select * from ftbbs_admin where admin_user='"&username&"'"
rs.open str,conn,3,1
		if rs.eof then
           response.write "<script langugae=javascript>alert('用户名不正确！');"
           response.write "window.location.href='../admin.asp';</script>"
           response.end 
		else
		   If rs("admin_pwd")=md5(password) then
            session("admin_user")=rs("admin_user")
			session("admin_pwd")=rs("admin_pwd")
			session("admin_qs")=rs("adminqs")
			session("qs")=rs("qs")
			'++++++++++++++++++++++++++
			sql1="Update ftbbs_admin set lasttime='"&Ftbbs_Time&"' where id="& rs("id")
			Conn.Execute(sql1)
			rs.close
			set rs=nothing
			session("errorcount")=0
			response.redirect "ftbbs_admin_index.asp"
		   else
		    session("errorcount")=session("errorcount")+1
            response.write "<script langugae=javascript>alert('你的密码不正确！');"
            response.write "window.location.href='../admin.asp';</script>"
            response.end 
		   end if
		end if
conn.close
set conn=nothing
%>