<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

dim startim,endtim,found_er,num,s_id,tim_ips,s_dlcs,s_dlsdjg,s_tim_star,s_tim_end,usercf,useripstop,usernames,usernamess
tim_ips=int(Format_Mid_Num(37))              	'锁定时间
s_dlcs=int(Format_Mid_Num(36))			'登陆错误次数
s_dlsdjg=int(Format_Mid_Num(38))		'锁定时间间隔
useripstop=int(Format_Mid_Num(39))		'锁定开关
usercf=0
num=1
'usernames=trim(request.form("logininfo"))
if trim(request.form("login_type"))="userloginid" then
	usernamess=trim(request.form("logininfo"))
	usernames="UID："&usernamess&""
else
	usernamess=trim(request.form("logininfo"))
	usernames="用户："&usernamess&""
End If

sub ip_stop1()
	if useripstop=0 then
		exit sub
	else
		sql="select * from AsaiMHIpstop where s_ip='"&user_ip&"'"
		set rs=Cls.exec(sql,1)
		if not rs.eof then
			call ip_stop4()
			rs.close
		else
			startim=Cls.now_time
			call Cls.exec("insert into AsaiMHIpstop(s_ip,s_username,s_tim_star,s_tim_end,s_dl_num,s_style,s_yj_stop) values('"&user_ip&"','"&usernames&"','"&startim&"','"&startim&"',"&num&",0,0)",0)
		end if
	end if
end sub

sub ip_stop4()
	num=rs("s_dl_num")
	s_id=rs("s_id")
	s_tim_star=rs("s_tim_star")
	s_tim_end=rs("s_tim_end")
	startim=Cls.now_time
	endtim=DateAdd("s",tim_ips,startim)
	if num>=s_dlcs then
		if datediff("s",s_tim_star,s_tim_end)>10 and datediff("s",s_tim_end,startim)<s_dlsdjg then
			call Cls.exec("update AsaiMHIpstop set s_style=1,s_yj_stop=1,s_tim_star='"&startim&"',s_tim_end='"&startim&"' where s_id="&s_id,0)
		else
			call Cls.exec("update AsaiMHIpstop set s_style=1,s_yj_stop=0,s_tim_star='"&startim&"',s_tim_end='"&endtim&"' where s_id="&s_id,0)	
			Call user_ip_stop1()
		end if
	else
		call Cls.exec("update AsaiMHIpstop set s_dl_num=s_dl_num+1 where s_id="&s_id,0)
	end if
end sub

sub user_ip_stop1()
	sql="select * from AsaiMHIpstop where s_style=1 and (s_ip='"&user_ip&"')"
	set rs=Cls.exec(sql,1)
	if not rs.eof then
		if rs("s_yj_stop")<>0 then
			Cls.LoadTemplate(4)
			Response.write Cls.ReHtml(ShowWebHead(0),1)
			Response.write "<br /><br /><table align=center border=0 cellspacing=1 cellpadding=4 style=""border: #000000 1px inset; margin:0px; margin-top:0px margin-right: 850px; background:#ffffff;""><tr><td bgcolor=#EF194A style=""color:#FFFFFF;font-weight:bold"" align=center><strong>"&Cls.Web_Name&" - "&Cls.Web_Url&"</strong></td></tr><tr><td bgcolor=#EF194A style=""color:#FFFFFF;font-weight:bold"" align=center><strong>程序版本Ver：<a href='http://77ya.Com'>"&Cls.pro_edition&"</a></strong></td></tr><tr><td><font color=red>对不起！你的ＩＰ地址：（"&user_ip&"）已被锁定！<br /><br />锁定时间："&rs("s_tim_star")&"<br /><br />永久锁定：系统不能自动解锁<br /><br />如有特殊情况，请跟管理员联系！！</font></td></tr></table><br /><br />"
			Response.write Cls.ReHtml(ShowWebEnd(0),1)
		else
			call user_ip_open()
			Cls.LoadTemplate(4)
			Response.write Cls.ReHtml(ShowWebHead(0),1)
			Response.write "<br /><br /><table align=center border=0 cellspacing=1 cellpadding=4 style=""border: #000000 1px inset; margin:0px; margin-top:0px margin-right: 850px; background:#ffffff;""><tr><td bgcolor=#EF194A style=""color:#FFFFFF;font-weight:bold"" align=center><strong>"&Cls.Web_Name&" - "&Cls.Web_Url&"</strong></td></tr><tr><td bgcolor=#EF194A style=""color:#FFFFFF;font-weight:bold"" align=center><strong>程序版本Ver：<a href='http://77ya.Com'>"&Cls.pro_edition&"</a></strong></td></tr><tr><td><font color=red>对不起！你的ＩＰ地址：（"&user_ip&"）已被锁定！<br /><br />锁定时间："&rs("s_tim_star")&"<br /><br />解锁时间："&rs("s_tim_end")&"<br /><br />无特殊情况，每次锁定"&tim_ips/60&"分钟自动解除！！</font></td></tr></table><br /><br />"
			Response.write Cls.ReHtml(ShowWebEnd(0),1)
		end if
		rs.close
		Call Web_Clear(1)
	else
		rs.close
		exit sub
	end if
end sub

sub user_ip_open()
	call Cls.exec("update AsaiMHIpstop set s_style=0,s_dl_num=0,s_tim_end='"&Cls.now_time&"' where s_ip='"&user_ip&"' and s_yj_stop=0 and ((s_style=1 and datediff("&SqlQ&"s"&SqlQ&",s_tim_end,'"&Cls.now_time&"')>0) or (s_dl_num>0 and datediff("&SqlQ&"s"&SqlQ&",s_tim_end,'"&Cls.now_time&"')>"&tim_ips&"))",0)
end sub 
%>
