<html>
<head>
<META content=ywnt,云网互动影视管理系统 name=keywords>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>云网互动影视6.0--IP策略管理</title>
<LINK href="css/css.css" type=text/css rel=stylesheet>
</head>
<BODY leftMargin=0 topMargin=0 scroll=yes MARGINHEIGHT="0" MARGINWIDTH="0">
<script language="JavaScript" src="YWNT_TMS_Inc/YWNT_TMS_Common.js"></script>
<!--#include file="../Conn.asp" -->
<!--#include file="YWNT_TMS_inc/YWNT_TMS_Function.asp" -->
<!--#include file="YWNT_TMS_inc/YWNT_TMS_Page.asp" -->
<%
'===================================================================================================================
'软件名称：云网影视管理系统
'Copyright (C) 2002-2007 ywnt.net  All rights reserved.
'产品咨询QQ：489234,2813712
'程序版权：云网互动科技有限公司
'程序开发：云网互动科技有限公司
'官方网站：http://www.ywnt.net 
'郑重声明:
'    1、免费版本请在程序首页保留版权信息，并做上本站LOGO友情连接,商业版本无此要求;
'    2、任何个人或组织不得在授权允许的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；
'    3、云网互动科技有限公司保留此软件的法律追究权利
'===================================================================================================================
Call CheckLogin("Ip")%>
<TABLE class=table cellSpacing=1 cellPadding=3 width="98%" align=center border=0>
  <TBODY>
    <TR>
      <TD class=xingmu colSpan=3>IP策略管理</TD>
    </TR>
    <TR>
      <TD class="hback"><a href="Admin_Ip.asp">IP策略管理首页</a> | <a href="Admin_Ip.asp?Action=Add">添加IP策略</a> | <a href="Admin_Ip.asp?IPTypeS=0">容许访问</a> | <a href="Admin_Ip.asp?IPTypeS=1">禁止访问</a></TD>
    </TR>
  </TBODY>
</TABLE>
<%Action=Trim(request("Action"))
Select Case Action
Case "Add"
	call Add()
Case "AddSave"
	call AddSave()
Case "Edit"
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Ip where ID="&NoSqlHack(Request("ID"))
		Rs.open sql,Conn,1,1
		YWNT_TMS_ID=RS("ID")
		YWNT_TMS_StartIP = RS("StartIP")
		YWNT_TMS_OverIP = RS("OverIP")
		YWNT_TMS_IPType=RS("IPType")
		YWNT_TMS_IPRemarks=RS("IPRemarks")
		StartIP = split(YWNT_TMS_StartIP,".")
		OverIP = split(YWNT_TMS_OverIP,".")
		RS.close
      	set RS=nothing
	call Edit()
Case "EditSave"
	call EditSave()
Case "Del"
	call Del()
Case else
	call IpList()
End Select
sub EditSave()
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Ip where ID="&NoSqlHack(Request.Form("ID"))
		Rs.open sql,Conn,1,3
		RS("StartIP")=NoSqlHack(Request.Form("StartIP1"))&"."&NoSqlHack(Request.Form("StartIP2"))&"."&NoSqlHack(Request.Form("StartIP3"))&"."&NoSqlHack(Request.Form("StartIP4"))
		RS("OverIP")=NoSqlHack(Request.Form("OverIP1"))&"."&NoSqlHack(Request.Form("OverIP2"))&"."&NoSqlHack(Request.Form("OverIP3"))&"."&NoSqlHack(Request.Form("OverIP4"))
		RS("StartIPS")=EncodeIP(NoSqlHack(Request.Form("StartIP1"))&"."&NoSqlHack(Request.Form("StartIP2"))&"."&NoSqlHack(Request.Form("StartIP3"))&"."&NoSqlHack(Request.Form("StartIP4")))
		RS("OverIPS")=EncodeIP(NoSqlHack(Request.Form("OverIP1"))&"."&NoSqlHack(Request.Form("OverIP2"))&"."&NoSqlHack(Request.Form("OverIP3"))&"."&NoSqlHack(Request.Form("OverIP4")))
		RS("IPType")=NoSqlHack(Request.Form("IPType"))
		RS("IPRemarks")=NoSqlHack(Request.Form("IPRemarks"))
		RS("IPDate")=Now()
		Rs.Update
		Rs.Close
		Set Rs = Nothing
		Call AddLog("修改IP策略",1)
		call Admin_ShowErr("<li>IP策略修改成功</li>","Admin_Ip.asp",1)
end sub
sub AddSave()
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Ip"
		Rs.open sql,Conn,1,3
		Rs.addnew
		RS("StartIP")=NoSqlHack(Request.Form("StartIP1"))&"."&NoSqlHack(Request.Form("StartIP2"))&"."&NoSqlHack(Request.Form("StartIP3"))&"."&NoSqlHack(Request.Form("StartIP4"))
		RS("OverIP")=NoSqlHack(Request.Form("OverIP1"))&"."&NoSqlHack(Request.Form("OverIP2"))&"."&NoSqlHack(Request.Form("OverIP3"))&"."&NoSqlHack(Request.Form("OverIP4"))
		RS("StartIPS")=EncodeIP(NoSqlHack(Request.Form("StartIP1"))&"."&NoSqlHack(Request.Form("StartIP2"))&"."&NoSqlHack(Request.Form("StartIP3"))&"."&NoSqlHack(Request.Form("StartIP4")))
		RS("OverIPS")=EncodeIP(NoSqlHack(Request.Form("OverIP1"))&"."&NoSqlHack(Request.Form("OverIP2"))&"."&NoSqlHack(Request.Form("OverIP3"))&"."&NoSqlHack(Request.Form("OverIP4")))
		RS("IPType")=NoSqlHack(Request.Form("IPType"))
		RS("IPRemarks")=NoSqlHack(Request.Form("IPRemarks"))
		RS("IPDate")=Now()
		Rs.Update
		Rs.Close
		Set Rs = Nothing
		Call AddLog("添加IP策略",1)
		call Admin_ShowErr("<li>IP策略添加成功</li>","Admin_Ip.asp",1)
end sub
sub Del()
	conn.execute "delete from YWNT_TMS_Ip WHERE ID="&NoSqlHack(Request("ID"))
	Call AddLog("删除IP策略",1)
	call Admin_ShowErr("<li>IP策略删除成功！</li>","Admin_Ip.asp",1)
end sub
%>
<%sub IpList()
Dim int_RPP
	int_RPP=GetConfig("PageNumber") '设置每页显示数目%>
<table class=table cellspacing=1 cellpadding=3 width="98%" 
align=center border=0>
  <tbody>
    <tr>
      <td width="5%" align="center" class=xingmu>ID</td>
      <td width="40%" align="center" class=xingmu>策略IP段</td>
      <td width="20%" align="center" class=xingmu>IP策略类型</td>
      <td width="19%" align="center" class=xingmu>添加时间</td>
      <td width="16%" align="center" class=xingmu>操作</td>
    </tr>
<%  Set Rs = server.CreateObject(YWNT_TMS_RS)
		sql="Select ID,StartIP,OverIP,IPType,IPDate from YWNT_TMS_Ip "
		if Request.QueryString("IPTypeS")<>"" then
			sql=sql&"where IPType="&NoSqlHack(Request.QueryString("IPTypeS"))&" Order by ID desc"
		else
			sql=sql&"Order by ID desc"
		end if
		Rs.open sql,Conn,1,1
	if Rs.eof then
	   Response.Write"<TR  class=""hback""><TD colspan=""6"" class=""hback"" height=""40"">没有记录。</TD></TR>"
	else
		Rs.PageSize=int_RPP
		cPageNo=NoSqlHack(Request.QueryString("Page"))
		If cPageNo="" Then cPageNo = 1
		If not isnumeric(cPageNo) Then cPageNo = 1
		cPageNo = Clng(cPageNo)
		If cPageNo>Rs.PageCount Then cPageNo=Rs.PageCount 
		If cPageNo<=0 Then cPageNo=1
		Rs.AbsolutePage=cPageNo 
	for i=1 to int_RPP
	 if Rs.eof Then exit For %> 
    <tr>
      <td height=32 align="center" class="hback"><%= RS("ID") %></td>
      <td height=32 align="center" class="hback"><%= RS("StartIP") %> —— <%= RS("OverIP") %></td>
      <td align="center" class="hback"><%call IPTypeW(Rs("IPType"))%></td>
      <td align="center" class="hback"><%= RS("IPDate") %></td>
      <td align="center" class="hback"><A href="Admin_Ip.asp?Action=Edit&ID=<%=RS("ID")%>">修改</A>｜<A href="Admin_Ip.asp?Action=Del&ID=<%=RS("ID")%>">删除</A></td>
    </tr>
<%  Rs.MoveNext
	next 
	end if%>
    <tr align="right">
      <td height=32 colspan="5" class="hback"><% response.Write fPageCount(Rs,cPageNo) %></td>
    </tr>
  </tbody>
</table>
<%end sub
sub Add()%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
 <form name="form" action="Admin_Ip.asp?Action=AddSave" method="post" onSubmit="return DformIP();">
  <tbody>
    <tr>
      <td colspan="4" class=xingmu>添加IP策略</td>
    </tr>
    <tr>
      <td width="21%" height=32 align="right" class="hback">开始IP地址段：</td>
      <td width="30%" class="hback"><input name="StartIP1" type="text" onKeyPress="onlyNum();" size="4" maxlength="3">
        .
        <input name="StartIP2" type="text" onKeyPress="onlyNum();" size="4" maxlength="3">
        .
        <input name="StartIP3" type="text" onKeyPress="onlyNum();" size="4" maxlength="3">
        .
      <input name="StartIP4" type="text" onKeyPress="onlyNum();" size="4" maxlength="3"></td>
      <td width="15%" align="right" class="hback">结束IP地址段：</td>
      <td width="35%" class="hback"><input name="OverIP1" type="text" onKeyPress="onlyNum();" size="4" maxlength="3">
        .
        <input name="OverIP2" type="text" size="4" onKeyPress="onlyNum();" maxlength="3">
        .
        <input name="OverIP3" type="text" size="4" onKeyPress="onlyNum();" maxlength="3">
        .
      <input name="OverIP4" type="text" size="4" onKeyPress="onlyNum();" maxlength="3"></td>
    </tr>
    <tr>
      <td width="21%" height=32 align="right" class="hback">IP策略类型：</td>
      <td colspan="3" class="hback"><select name="IPType">
        <option value="0">容许访问</option>
        <option value="1">禁止访问</option>
      </select>
      </td>
    </tr>
    <tr>
      <td height=32 align="right" class="hback">IP策略备注：</td>
      <td height=32 colspan="3" class="hback"><textarea name="IPRemarks" cols="50" rows="5"></textarea></td>
    </tr>
    <tr align="center">
      <td height=32 colspan="4" class="hback"><input type="submit" name="Submit" value="提 交">
        <input type="reset" name="reset" value="重 置"></td>
    </tr>
  </tbody>
</form>
</table>
<%end sub
sub Edit()%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <form name="form" action="Admin_Ip.asp?Action=EditSave" method="post" onSubmit="return DformIP();">
    <tbody>
      <tr>
        <td colspan="4" class=xingmu>修改IP策略</td>
      </tr>
      <tr>
        <td width="21%" height=32 align="right" class="hback">开始IP地址段：</td>
        <td width="30%" class="hback"><input name="StartIP1" type="text" onKeyPress="onlyNum();" value="<%=StartIP(0)%>" size="4" maxlength="3">
          .
            <input name="StartIP2" type="text" size="4" onKeyPress="onlyNum();" value="<%=StartIP(1)%>" maxlength="3">
          .
          <input name="StartIP3" type="text" size="4" onKeyPress="onlyNum();" value="<%=StartIP(2)%>" maxlength="3">
          .
          <input name="StartIP4" type="text" size="4" onKeyPress="onlyNum();" value="<%=StartIP(3)%>" maxlength="3"></td>
        <td width="15%" align="right" class="hback">结束IP地址段：</td>
        <td width="35%" class="hback"><input name="OverIP1" type="text" size="4" onKeyPress="onlyNum();" value="<%=OverIP(0)%>" maxlength="3">
          .
            <input name="OverIP2" type="text" size="4" onKeyPress="onlyNum();" value="<%=OverIP(1)%>" maxlength="3">
          .
          <input name="OverIP3" type="text" size="4" onKeyPress="onlyNum();" value="<%=OverIP(2)%>" maxlength="3">
          .
          <input name="OverIP4" type="text" size="4" onKeyPress="onlyNum();" value="<%=OverIP(3)%>" maxlength="3"></td>
      </tr>
      <tr>
        <td width="21%" height=32 align="right" class="hback">IP策略类型：</td>
        <td colspan="3" class="hback"><select name="IPType">
            <option value="0" <%if YWNT_TMS_IPType=0 then Response.Write("selected")%>>容许访问</option>
            <option value="1" <%if YWNT_TMS_IPType=1 then Response.Write("selected")%>>禁止访问</option>
          </select>
        </td>
      </tr>
      <tr>
        <td height=32 align="right" class="hback">IP策略备注：</td>
        <td height=32 colspan="3" class="hback"><textarea name="IPRemarks" cols="50" rows="5"><%=YWNT_TMS_IPRemarks%></textarea></td>
      </tr>
      <tr align="center">
        <td height=32 colspan="4" class="hback"><input name="ID" type="hidden" value="<%= YWNT_TMS_ID %>"><input type="submit" name="Submit" value="提 交">
          <input type="reset" name="reset" value="重 置"></td>
      </tr>
    </tbody>
  </form>
</table>
<%End sub
call connclose()%>
</BODY></HTML>
