<%
dim startim,endtim,found_err,num,s_id,tim_ips,s_dlcs,s_dlsdjg,s_tim_star,s_tim_end,usercf
tim_ips=int(dim_num(32))
s_dlcs=int(dim_num(31))
s_dlsdjg=int(dim_num(30))
usercf=0
num=1
sub ip_stop1()
call user_ip_open()
sql="select * from jk_stopip where s_ip='"&user_ip&"'"
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then
 call ip_stop4()
 rs.close
else
 startim=joekoe_cms.now_time
 call joekoe_cms.exec("insert into jk_stopip(s_ip,s_username,s_tim_star,s_tim_end,s_dl_num,s_style) values('"&user_ip&"','"&username&"','"&startim&"','"&startim&"',"&num&",0)",0)
end if
'call cookies_clear(0)
end sub

sub ip_stop2()
call user_ip_open()
sql="select * from jk_stopip where s_style=1 and (s_ip='"&user_ip&"')"
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then 
  if rs("s_yj_stop")<>0 then
	call ip_admindlyjstop()
  else
	call ip_admindlstop()
  end if
  rs.close
  exit sub
 else
 call ip_admindl()
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=joekoe_cms.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 joekoe_cms.exec("update jk_stopip set s_style=1,s_yj_stop=1,s_tim_star='"&startim&"',s_tim_end='"&startim&"' where s_id="&s_id,0)
	exit sub
 end if
 call joekoe_cms.exec("update jk_stopip set s_style=1,s_yj_stop=0,s_tim_star='"&startim&"',s_tim_end='"&endtim&"' where s_id="&s_id,0)		
 exit sub
else
 call joekoe_cms.exec("update jk_stopip set s_dl_num=s_dl_num+1 where s_id="&s_id,0)
 exit sub
end if
end sub

sub ip_admindl()
 %>
<table border=0 cellspacing=0 cellpadding=0 width=526>
<form name=admin_frm action='?' method=post>
<input type=hidden name=admin_log value='ok'>
<tr><td colspan=2><img src='images/admin/al_top.gif' border=0></td></tr>
<tr><td colspan=2>
  <table border=0 cellspacing=0 cellpadding=0 width=526>
  <tr>
  <td width=155><img src='images/admin/al_username.gif' border=0></td>
  <td width=105 background='images/admin/al_body_bg.gif'><input type=text name=username value='<%response.write login_username%>' size=15 maxlength=20 class=input_login></td>
  <td width=93><img src='images/admin/al_password.gif' border=0></td>
  <td width=105 background='images/admin/al_body_bg.gif'><input type=password name=password value='' size=15 maxlength=20 class=input_login<%if int(format_mid_num(46))=0 then%> readOnly onKeyDown="Calc.password.value=this.value" onChange="Calc.password.value=this.value" onclick="password1=this;showkeyboard();this.readOnly=1;Calc.password.value=''"<%end if%>></td>
  <td width=68><img src='images/admin/al_body_right.gif' border=0></td>
  </tr>
  </table>
</td></tr>
<tr><td colspan=2>
  <table border=0 cellspacing=0 cellpadding=0 width=526>
  <tr>
  <td width=77><img src='images/admin/al_end_left.gif' border=0></td>
  <td width=339>
    <table border=0 cellspacing=0 cellpadding=0 width=339>
    <tr><td height=49 background='images/admin/al_end_bg.gif' align=center>
      <table border=0>
      <tr class=tr_val>
      <td>验证码：</td>
      <td><input type=password name=valcode value='' size=18 maxlength=20 class=input_val></td>
      <td width=10></td>
      <td>同时登陆前台：</td>
      <td><input type=checkbox name=logins value='yes'></td>
      </tr>
      </table>
    </td></tr>
    <tr><td><img src='images/admin/al_end_end.gif' border=0></td></tr>
    </table>
  </td>
  <td width=110><img src='images/admin/al_end_right.gif' border=0 onclick="javascript:admin_login_chk();" style="cursor: hand;"></td>
  </tr>
  </table>
</td></tr>
</form>
</table>
 <script language=javascript src='style/admin_login.js'></script>
<script language=JavaScript src='style/softkeyboard.js'></script>
<script>
window.onload=
	function ()
	{
		password1=null;		
		initCalc();
		Load();
	}
</script>
<%
end sub

sub ip_admindlstop()
%>
 <table border=0 cellspacing=0 cellpadding=0 width=526>
 <tr><td colspan=2><img src='images/admin/al_top.gif' border=0></td></tr>
 <tr><td colspan=2>
 <table border=0 cellspacing=0 cellpadding=0 width=526>
 <tr><td align=center><font class=red>对不起！你的ＩＰ地址：（<%response.write user_ip%>）已经被锁定！</font></td></tr>
 <tr><td align=center><font class=red>锁定时间为：<%response.write rs("s_tim_star")%>&nbsp;&nbsp;解锁时间为：<%response.write rs("s_tim_end")%></font></td></tr>
 <tr><td align=center><font class=red>无特殊情况，每次锁定"&tim_ips/60%>分钟自动解除！</font></td></tr>
 </table>
 </td></tr>
 <tr><td colspan=2>
   <table border=0 cellspacing=0 cellpadding=0 width=526>
   <tr>
    <td width=77><img src='images/admin/al_end_left.gif' border=0></td>
    <td width=339>
     <table border=0 cellspacing=0 cellpadding=0 width=339>
     <tr><td height=49 background='images/admin/al_end_bg.gif' align=center>
       <table border=0>
	   <tr class=tr_val>
	   <td></td>
	   <td></td>
	   </tr>
	   </table>
     </td></tr>
	 <tr><td><img src='images/admin/al_end_end.gif' border=0></td></tr>
     </table>
	</td>
	<td width=110><img src='images/admin/al_end_right.gif' border=0></td>
   </tr>
 </table>
 </td></tr>
 </table>
 <%
end sub

sub ip_admindlyjstop()
%>
 <table border=0 cellspacing=0 cellpadding=0 width=526>
 <tr><td colspan=2><img src='images/admin/al_top.gif' border=0></td></tr><tr><td colspan=2>
 <table border=0 cellspacing=0 cellpadding=0 width=526>
 <tr><td align=center><font class=red>对不起！你的ＩＰ地址：（<%response.write user_ip%>）已经被锁定！</font></td></tr>
 <tr><td align=center><font class=red>锁定时间为：<%response.write rs("s_tim_star")%>&nbsp;&nbsp;永久锁定：系统不能自动解锁</font></td></tr>
 <tr><td align=center><font class=red>如有特殊情况，请跟管理员联系！！</font></td></tr></table></td></tr>
 <tr><td colspan=2>
 <table border=0 cellspacing=0 cellpadding=0 width=526><tr><td width=77><img src='images/admin/al_end_left.gif' border=0></td><td width=339>
 <table border=0 cellspacing=0 cellpadding=0 width=339><tr><td height=49 background='images/admin/al_end_bg.gif' align=center>
 <table border=0><tr class=tr_val><td></td><td></td></tr></table>
 </td></tr><tr><td><img src='images/admin/al_end_end.gif' border=0></td></tr>
 </table></td><td width=110><img src='images/admin/al_end_right.gif' border=0></td></tr>
 </table></td></tr>
 </table>
 <%
end sub

sub user_dl_cf()
 sql="select top 1 * from user_login where l_username='"&username&"'"
 set rs=conn.execute(sql)
 if int(format_mid_num(33))=1 then
 exit sub
end if
 if not rs.eof then
  usercf=1
  found_err=found_err&"您输入的用户名：<font class=red>"&username&"</font>已经登陆 ！<br>" & _
  found_err&"登陆本站时间为：<font class=red>"&rs("l_tim_login")&"</font><br>" & _
  found_err&"登陆客户端IP为：<font class=red>"&rs("l_ip")&"</font><br>" & _
  found_err&"因不正常退出被锁定的，请过几分钟后再试！<br>" & _
  found_err&"请查找原因并重新输入以继续登陆本站！"
  rs.close:set rs=nothing
  response.write found_error(found_err,260)
  exit sub
 end if
end sub

sub user_ip_stop1(un)
 call user_ip_open()
 useripstop=0
 sql="select * from jk_stopip where s_style=1 and (s_ip='"&user_ip&"')"
 set rs=joekoe_cms.exec(sql,1)
  if not rs.eof then
   if un=1 then
    useripstop=1
   end if
   if rs("s_yj_stop")<>0 then
    response.write "<center><font class=red>对不起！你的ＩＰ地址：（"&user_ip&"）已被锁定！<br><br>锁定时间："&rs("s_tim_star")&"<br><br>永久锁定：系统不能自动解锁<br><br>如有特殊情况，请跟管理员联系！！</font></center>"
   else
    response.write "<center><font class=red>对不起！你的ＩＰ地址：（"&user_ip&"）已被锁定！<br><br>锁定时间："&rs("s_tim_star")&"<br><br>解锁时间："&rs("s_tim_end")&"<br><br>无特殊情况，每次锁定"&tim_ips/60&"分钟自动解除！！</font></center>"
   end if
   rs.close
   call cookies_clear(1)
   exit sub
  end if
end sub

sub user_ip_stop2(nu)
 if nu=1 then
   useripstop=1 
   call cookies_clear(1)
 end if
 sql="select * from jk_stopip where s_ip='"&user_ip&"'"
 set rs=joekoe_cms.exec(sql,1)
 if not rs.eof then
  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=joekoe_cms.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 joekoe_cms.exec("update jk_stopip set s_style=1,s_yj_stop=1,s_tim_star='"&startim&"',s_tim_end='"&startim&"' where s_id="&s_id,0)
      response.write "<font class=red>对不起！你的ＩＰ地址：（"&user_ip&"）开始锁定！<br><br>锁定开始："&startim&"<br><br>永久锁定：系统不能自动解锁<br><br>如有特殊情况，请跟管理员联系！！</font>"
	  rs.close
	  exit sub
    end if
	call joekoe_cms.exec("update jk_stopip set s_style=1,s_yj_stop=0,s_tim_star='"&startim&"',s_tim_end='"&endtim&"' where s_id="&s_id,0)
    response.write "<font class=red>对不起！你的ＩＰ地址：（"&user_ip&"）开始锁定！<br><br>锁定开始："&startim&"<br><br>解锁时间："&endtim&"<br><br>无特殊情况，每次锁定"&tim_ips/60&"分钟自动解除！！</font>"
	rs.close
    exit sub
  else
   call joekoe_cms.exec("update jk_stopip set s_dl_num=s_dl_num+1 where s_id="&s_id,0)
   found_err=found_err&"+您输入的 <font class=red>用户名称</font> 和 <font class=red>登陆密码</font>  有错误！<br>" & _
   found_err&"+请重新输入以并继续登陆本站！"
   response.write found_error(found_err,260)
   rs.close
   exit sub
  end if
else
  startim=joekoe_cms.now_time
  call joekoe_cms.exec("insert into jk_stopip(s_ip,s_username,s_tim_star,s_tim_end,s_dl_num,s_style) values('"&user_ip&"','"&username&"','"&startim&"','"&startim&"',"&num&",0)",0)
  found_err=found_err&"+您输入的 <font class=red>用户名称</font> 和 <font class=red>登陆密码</font>  有错误！<br>" & _
  found_err&"+请重新输入以并继续登陆本站！"
  response.write found_error(found_err,260)
  rs.close
  exit sub
end if
end sub

sub user_ip_open()
 if joekoe_cms.web_vt=1 then
   call joekoe_cms.exec("update jk_stopip set s_style=0,s_dl_num=0,s_tim_end='"&joekoe_cms.now_time&"' where s_yj_stop=0 and ((s_style=1 and datediff(second,s_tim_end,'"&joekoe_cms.now_time&"')>0) or (s_dl_num>0 and datediff(second,s_tim_end,'"&joekoe_cms.now_time&"')>"&tim_ips&"))",0)
 else
   call joekoe_cms.exec("update jk_stopip set s_style=0,s_dl_num=0,s_tim_end='"&joekoe_cms.now_time&"' where s_yj_stop=0 and ((s_style=1 and datediff('s',s_tim_end,'"&joekoe_cms.now_time&"')>0) or (s_dl_num>0 and datediff('s',s_tim_end,'"&joekoe_cms.now_time&"')>"&tim_ips&"))",0) 
 end if
end sub 
%>
