<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!--#include file="Ex_Cls/Ex_CommonCls.asp"-->
<!--#include file="Ex_Cls/Ex_SplitPageCls.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css" />
</head>

<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor" >
<%
Dim ExComm
Set ExComm=new Ex_CommonCls
ExComm.IsAdLogin 
ExComm.IsIpAllow
dim action
action=request.querystring("action")
select case action
case "add"
call add()
case "show"
call addf()
Call show
Case "del"
Call del()
Case "delmore"
Call delmore()
end select
sub addf()
%>
<SCRIPT language=javascript>
function checkip() 
{
var IP =document.all.adip.value
var exp=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/; 
var reg = IP.match(exp); 
if(reg==null) 
	{ 
		alert("你输入的是一个非法的IP地址段！\nIP段为：:xxx.xxx.xxx.xxx（xxx为0-255)！"); 
	return false;
	
	} 
return true;

} 



</script>
<form id="form1" name="form1" method="post" action="admin_ip.asp?action=add" onSubmit="return checkip()">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
    <tr>
      <td height="24" colspan="3" class="topbg"><CENTER>
        增加ip地址
      </CENTER></td>
    </tr>
    <tr class="tdbg">
      <td><CENTER>ip地址：</CENTER></td>
      <td><center><input type="text" name="adip" id="adip"size="25" maxlength="25"/></center></td>
      <td><CENTER><input type="submit" name="Submit" value="增加ip" /></CENTER></td>
    </tr>
  </table>
</form>
<%end Sub
Sub add()
Dim ip
ip=request.Form("adip")
Conn.execute("insert into Ex_lockip (lockip) values('"&ip&"')")
ExComm.ClearCache(sn&"ip")
ExComm.GetIpCache()
ExComm.ShowMsg "添加成功","admin_ip.asp?action=show"
End Sub
Sub show()
Dim iprs,ipsql
Dim ExPages,page
Set ExPages=new  Ex_SplitPageCls
Expages.letConn=Conn
Expages.letColumns="select *"
ExPages.letDataFrom="from Ex_LockIp"
Set iprs=server.CreateObject("adodb.recordset")
Expages.letPageSize="15"
If ExComm.G(request("page"))="" Then
	page=1
Else
	page=ExComm.G(request("page"))
End if
ExPages.letPage=CInt(page)
ExPages.letStrPage=""
ExPages.Execute()
%>
<script language="javascript">
function checkall(theform)
{for(var i=0;i<theform.elements.length;i++)
 { var e = theform.elements[i];
    if (e.Name != "selectall")
       e.checked = theform.selectall.checked;
 }
}
</script>
<form id="form1" name="form1" method="post" action="admin_ip.asp?action=delmore">
 <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
    <tr>
      <td height="21" colspan="3" class="topbg"><CENTER>ip地址管理</CENTER></td>
    </tr>
    <tr class="tdbg">
      <td>选中</td>
      <td><CENTER>ip地址</CENTER></td>
      <td><CENTER>删除</CENTER></td>
    </tr>
	<%If CInt(Expages.Ex_idCount)<>0 Then
	Set IpRs=ExPages.getRs
	Do While Not iprs.eof 
	%>
    <tr class="tdbg">
      <td><input type="checkbox" name="ids" id="ids" value="<%=iprs("id")%>" /></td>
      <td><CENTER><%=iprs("lockip")%></CENTER></td>
      <td><a href="admin_ip.asp?action=del&id=<%=iprs("id")%>" onclick="return confirm('是否要删除?')"><CENTER>删除</CENTER></a></td>
    </tr>
	<%
	iprs.movenext
	loop
	End if%>
    <tr class="tdbg">
      <td><input type="checkbox" name="selectall" value="checkbox" onClick="checkall(this.form)"/>
      全选</td>
      <td>删除
      <input name="radiobutton" type="radio" value="radiobutton" /></td>
      <td><input type="submit" name="Submit" value="确定" /></td>
    </tr>
  </table>
</form>
<center>
<%=ExPages.Show%>
<center>
<%
End Sub
Sub del()
Dim id
id=request.querystring("id")
Conn.execute("delete * from Ex_lockip where id="&id)
ExComm.ClearCache(sn&"ip")
ExComm.GetIpCache()
ExComm.ShowMsg "删除成功",request.servervariables("http_referer")
End Sub
Sub delmore()
Dim ids,i
ids=request.Form("ids")
ids=Split(ids,",")
for i=0 To UBound(ids)
Conn.execute("delete * from Ex_lockip where id="&ids(i))
Next
ExComm.ClearCache(sn)
ExComm.GetIpCache()
ExComm.ShowMsg "删除成功",request.servervariables("http_referer")
End sub%>
</body>
</html>
