admin_ip.asp

来自「关于网络渗透技术的详细讲解」· ASP 代码 · 共 190 行

ASP
190
字号
<!-- #include file="../Conn.asp" -->
<!-- #include file="inc.asp" -->
<%
'====================================================================
'=              Copyright (c) 2004,NB联盟 E.P.K开发小组             =
'=                      All rights reserved.                        =
'=------------------------------------------------------------------=
'=                     文件名称:Admin_Ip.asp                       =
'=                     摘    要:后台—ip管理文件                   =
'=------------------------------------------------------------------=
'=                     最后更新:eason007                           =
'=                     最后日期:2004-10-15                         =
'====================================================================

Admin_Nav

If Instr(1,Session("Master_Power"),"42,")<=0 Then 
	ErrMsg="对不起,你没有访问该页面的权限"
	Call Error(1)
End If

Dim Atcion
Dim PostId,Typer
Atcion=Request.QueryString ("atcion")
PostId=Request.QueryString ("postid")

Select Case Atcion
Case "save"
	Call Save
Case "del"
	Call del
Case "add"
	Call Add
Case Else
	Call Main
End Select

Sub Main
	Dim Count,PageCount,Page,OutStr,i
	Dim FieldName(0),FieldValue(0)
	Dim WStr,TopicList
	
	Page=Request.QueryString ("page")
	If Not IsNumeric(Page) Or Page="" Or Page="0" Then
		Page=1
	End If
%>
<table width="98%" cellpadding=3 cellspacing=1 align="center" style="border: 1 solid #808080">	
	<tr height=22>
		<th width="10%">Id</th>
		<th width="35%">IP头</th>
		<th width="35%">IP尾</th>
		<th width="20%">操作</th>
	</tr>
    <%
    SQL="select count(id) from [NB_Ip]"
	'Response.Write sql
	Set rs=conn.execute(sql)
	Count=rs(0)
	If Count=<0 Then 
		OutStr="<tr height='22' bgcolor='ffffff' width='98%'>"
		OutStr=OutStr&"<td colspan='5'>&nbsp;<font color='red'>暂无内容</font></td>"
		OutStr=OutStr&"</tr></table>"
		response.write OutStr
		response.flush
	Else
		sql="select Top "&Page*20&" id,head_ip,foot_ip"
		SQL=SQL&" from [NB_Ip] order by id desc"
		'Response.Write sql
		set rs=conn.execute(sql)
		
		If Cint(Page) <>1 Then rs.move 20*(page-1)
		
		TopicList=rs.getrows(20)
		rs.close:Set rs=Nothing
	
	    For i=0 To Ubound(TopicList,2)
	%>
    <tr valign="middle" bgcolor="ffffff" align="center" height=22 onmouseover=this.style.backgroundColor='E4E8EF' onmouseout=this.style.backgroundColor=''>
      <td><%=TopicList(0,i)%></td>
      <td><%=ShowIp(TopicList(1,i))%></td>
      <td><%=ShowIp(TopicList(2,i))%></td>
      <td><a href="?atcion=add&postid=<%=TopicList(0,i)%>">编辑</a> | <a href="?atcion=del&postid=<%=TopicList(0,i)%>" onclick="{if(confirm('确定删除吗?')){return true;}return false;}">删除</a></td>
    </tr>
    <%	Response.Flush
		Next%>
	<tr valign="middle" bgcolor="ffffff" align="right" height="22">
      <td colspan="4"><%=PageList(20,Count,Page,FieldName,FieldValue)%>&nbsp;&nbsp;</td>
    </tr>
	<%End If%>
</table>
<%
End Sub

Sub Add
	Dim PostId
	Dim Head,Foot
	PostId=Request.QueryString ("postid")

	If IsNumeric(PostId) And PostId<>"" And PostId<>"0" Then
		Sql="select id,head_ip,foot_ip from [NB_Ip] where id="&PostId
		Set rs=conn.execute(sql)
		If Not rs.eof And Not rs.bof Then 
			Head=SplitIp(rs(1))
			Foot=SplitIp(rs(2))
		End If
		rs.close
	End If
%>
<table width="95%"  cellpadding="1" cellspacing="1" align="center" class=TableBorder>
	<tr> 
		<td width="100%" class=forumRow height="22" valign="middle" align="left"><P><font color=red><B>说明</B></font>:<BR>		①如屏蔽一段ip,只需输入该段的开始ip及结束ip即可。如屏蔽192.168.1.1至192.168.1.100的ip段,只需填入192.168.1.1和192.168.1.100即可
		<br>②如只屏蔽一个ip,则开始ip及结束ip都为该ip地址。</P></td>
	</tr>
</table>
<br>
<table width="80%" border="0" cellpadding=3 cellspacing=1 align="center" style="border: 1 solid #808080">
  <form name=a1  method="post" action="?atcion=save&postID=<%=postid%>">
    <tr align="center" valign="middle"> 
      <th colspan="9" height="22">ip管理</th>
    </tr>
    <tr bgcolor="#FFFFFF" valign="middle" height="22"> 
      <td width="10%" align="center" bgcolor="efefef">开始ip</td>
      <td><input type="text" name="head" size="4" value="<%If IsArray(Head) Then Response.Write Head(0)%>" maxlength="3">.<input type="text" name="head" size="4" value="<%If IsArray(Head) Then Response.Write Head(1)%>" maxlength="3">.<input type="text" name="head" size="4" value="<%If IsArray(Head) Then Response.Write Head(2)%>" maxlength="3">.<input type="text" name="head" size="4" value="<%If IsArray(Head) Then Response.Write Head(3)%>" maxlength="3"></td>
      <td width="10%" align="center" bgcolor="efefef">结束ip</td>
      <td><input type="text" name="foot" size="4" value="<%If IsArray(Foot) Then Response.Write Foot(0)%>" maxlength="3">.<input type="text" name="foot" size="4" value="<%If IsArray(Foot) Then Response.Write Foot(1)%>" maxlength="3">.<input type="text" name="foot" size="4" value="<%If IsArray(Foot) Then Response.Write Foot(2)%>" maxlength="3">.<input type="text" name="foot" size="4" value="<%If IsArray(Foot) Then Response.Write Foot(3)%>" maxlength="3"></td>
    </tr>
    <tr bgcolor="efefef"> 
      <td align="center" valign="middle" colspan="4"><input type="submit" name="Submit" value="更新">&nbsp;<input type="reset" name="Submit2" value="重置"></td>
    </tr>
  </form>
</table>
<%End Sub

Function Del
	If Not ChkPost Then 
		ErrMsg="对不起,请不要从外部提交数据!"
		Call Error(1)
	End If

	If IsNumeric(PostId) And PostId<>"" And PostId<>"0" Then
		conn.execute("delete from [NB_Ip] where ID="&postID)
	End If
	
	CloseDataBase
	Response.Redirect Request.ServerVariables("HTTP_REFERER")
End Function

Function Save
	If Not ChkPost Then 
		ErrMsg="对不起,请不要从外部提交数据!"
		Call Error(1)
	End If
	
	Dim Head,Foot
	Dim PostId
	PostId=Request.QueryString ("postid")
	Head=Replace(Request.Form ("Head"),", ",".")
	Foot=Replace(Request.Form ("foot"),", ",".")
	Head=FormatIp(Head)
	Foot=FormatIp(Foot)

	If rs.state=1 Then rs.close
	If IsNumeric(PostId) And PostId<>"" And PostId<>"0" Then
		Sql="select head_ip,foot_ip from [NB_Ip] where Id="&PostId
		rs.open Sql,conn,2,2
		rs.movefirst
		rs("head_ip")=Head
		rs("foot_ip")=Foot
		rs.update
	Else
		Sql="select head_ip,foot_ip from [NB_Ip]"
		rs.open Sql,conn,2,2
		rs.addnew
		rs("head_ip")=Head
		rs("foot_ip")=Foot
		rs.update
	End If
	rs.close
	set rs=nothing
	
	closedatabase
	Response.Redirect "Admin_ip.asp"
End Function
%>




⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?