<%
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()
 %>
<SCRIPT language=javascript>
function check_input()	{
      if (document.admin_frm.username.value == '')	{
	 alert("请输入用户名！");
  	 document.admin_frm.username.focus();
	 return false;
	}
      if (document.admin_frm.password.value == '')	{
	 alert("请输入密码！");
  	 document.admin_frm.password.focus();
	 return false;
	}
      return true;
}
//-->
</SCRIPT>

<STYLE>TD {
	FONT-SIZE: 9pt; COLOR: #333333; LINE-HEIGHT: normal; FONT-FAMILY: "宋体"
}

.form {
	BORDER-RIGHT: #999999 1px solid; BORDER-TOP: #999999 1px solid; FONT-SIZE: 9pt; BORDER-LEFT: #999999 1px solid; COLOR: #043b9c; BORDER-BOTTOM: #999999 1px solid; HEIGHT: 17px; BACKGROUND-COLOR: #ffffff
}

</STYLE>
<CENTER>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" 
background=images/login/bg.gif border=0>
  <TBODY>
  <TR>
    <TD vAlign=center align=middle>
      <TABLE height=402 cellSpacing=0 cellPadding=0 width=562 bgColor=#f4f4f4 
      border=0>
        <TBODY>
        <TR>
          <TD vAlign=center align=middle>
            <TABLE cellSpacing=0 cellPadding=0 width=560 border=0>
              <TBODY>
              <TR>
                <TD><IMG height=40 alt="" src="images/login/index_01.gif" 
                  width=142></TD>
                <TD><IMG height=40 alt="" src="images/login/index_02.gif" 
                  width=171></TD>
                <TD><IMG height=40 alt="" src="images/login/index_03.gif" 
                  width=130></TD>
                <TD><IMG height=40 alt="" src="images/login/index_04.gif" 
                  width=117></TD></TR>
              <TR>
                <TD><IMG height=49 alt="" src="images/login/index_05.gif" 
                  width=142></TD>
                <TD colSpan=2>
                  <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD width="10%"><IMG height=49 alt="" 
                        src="images/login/index_06.gif" width=90></TD>
                      <TD width="90%"><IMG height=49 alt="" 
                        src="images/login/index_07.gif" 
                  width=211></TD></TR></TBODY></TABLE></TD>
                <TD><IMG height=49 alt="" src="images/login/index_08.gif" 
                  width=117></TD></TR>
              <TR>
                <TD><IMG height=55 alt="" src="images/login/index_09.gif" 
                  width=142></TD>
                <TD><IMG height=55 alt="" src="images/login/index_10.gif" 
                  width=171></TD>
                <TD><IMG height=55 alt="" src="images/login/index_11.gif" 
                  width=130></TD>
                <TD><IMG height=55 alt="" src="images/login/index_12.gif" 
                  width=117></TD></TR>
              <TR>
                <TD colSpan=4 height=170>
                  <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD width="25%"><IMG height=62 alt="" 
                        src="images/login/index_13.gif" width=142></TD>
                      <TD vAlign=center align=middle width="61%" bgColor=#f4f4f4 
                      rowSpan=2>
                       <form name=admin_frm action='?'  onsubmit="return check_input();" 
                        method=post target=_top>
						<input type=hidden name=admin_log value='ok'>
                        <TABLE height=80 cellSpacing=1 cellPadding=5 width="92%" 
                        border=0>
                          <TBODY>
                          <TR vAlign=center align=middle bgColor=#ffffff>
                            <TD width="24%"><FONT color=#5a514a>账　　号</FONT></TD>
                            <TD colSpan=2>
                              <DIV align=left><FONT color=#5a514a></FONT><FONT color=#5a514a>
                                <INPUT 
                              class=form name=username size=23 name=name value='<%=login_username%>'>
                              </FONT><FONT 
                              color=#ff0000></FONT></DIV></TD></TR>
                          <TR vAlign=center align=middle bgColor=#ffffff>
                            <TD><FONT color=#5a514a>密　　码</FONT></TD>
                            <TD bgColor=#ffffff colSpan=2>
                              <DIV align=left><FONT color=#5a514a>
                                <INPUT 
                              class=form name=password type=password size=25 name=pwd>
                              </FONT></DIV></TD></TR>
                          <TR vAlign=center align=middle bgColor=#ffffff>
                            <TD><FONT color=#5a514a>验 证 码</FONT></TD>
                            <TD colSpan=2>
                              <DIV align=left><FONT color=#5a514a>							  
							  <input class=form type=password name=valcode value='' size=15 maxlength=20 class=input_val>
                              &nbsp;登陆前台：<input type=checkbox name=logins value='yes'>
                              </FONT></DIV></TD></TR>
                          <TR vAlign=center align=middle bgColor=#ffffff>
                            <TD colSpan=3>
                              <DIV align=center>非管理员，请勿登陆，否则追究法律责任 
                          </DIV></TD></TR></TBODY></TABLE>
                        <TABLE height=33 cellSpacing=0 cellPadding=0 width="77%" 
                        border=0>
                          <TBODY>
                          <TR vAlign=bottom align=middle>
                            <TD><INPUT type=image height=20 width=39 
                              src="images/login/login.gif" border=0 name=B1></TD>
                            <TD><A 
                              href="javascript:document.domainlogin.reset();"><IMG 
                              height=20 src="images/login/clear.gif" width=39 
                              border=0></A></TD></TR></TBODY></TABLE></FORM></TD>
                      <TD width="14%"><IMG height=62 alt="" 
                        src="images/login/index_15.gif" width=117></TD></TR>
                    <TR>
                      <TD height=108><IMG height=108 alt="" 
                        src="images/login/index_16.gif" width=142></TD>
                      <TD><IMG height=108 alt="" src="images/login/index_18.gif" 
                        width=117></TD></TR></TBODY></TABLE></TD></TR>
              <TR>
                <TD><IMG height=44 alt="" src="images/login/index_19.gif" 
                  width=142></TD>
                <TD><IMG height=44 alt="" src="images/login/index_20.gif" 
                  width=171></TD>
                <TD><IMG height=44 alt="" src="images/login/index_21.gif" 
                  width=130></TD>
                <TD><IMG height=44 alt="" src="images/login/index_22.gif" 
                  width=117></TD></TR>
              <TR>
                <TD><IMG height=42 alt="" src="images/login/index_23.gif" 
                  width=142></TD>
                <TD><IMG height=42 alt="" src="images/login/index_24.gif" 
                  width=171></TD>
                <TD><IMG height=42 alt="" src="images/login/index_25.gif" 
                  width=130></TD>
                <TD><IMG height=42 alt="" src="images/login/index_26.gif" 
                  width=117></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER>
<%
end sub

sub ip_admindlstop()
%>
 <table border=0 cellspacing=0 cellpadding=0 width=526>
 <tr><td colspan=2><img src='images/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/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/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/al_end_end.gif' border=0></td></tr>
     </table>
	</td>
	<td width=110><img src='images/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/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/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/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/al_end_end.gif' border=0></td></tr>
 </table></td><td width=110><img src='images/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()

   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 sub 
%>
