28,408
社区成员
发帖
与我相关
我的任务
分享
sub ipfind()
'IP查找\状态查看
call chk_login()
'权限判断
dim i,intPage,page,pre,last,filepath,sqlcx,cx_cxfs,sql
set rs = Server.CreateObject("ADODB.RecordSet")
cx_cxfs=request.Form("cxfs")
cx_cxnr=request.Form("cxnr")
select case cx_cxfs
case 1 '所有数据
sqlcx="select * from ip order by id,branch_name"
case 2 '机构查询
sqlcx="select * from ip where branch_name like '%"&request.Form("cxnr")&"%' order by id"
case 3 '部门查询
sqlcx="select * from ip where Departments like '%"&request.Form("cxnr")&"%' order by id"
case 4 '使用者查询
sqlcx="select * from ip where user_name like '%"&request.Form("cxnr")&"%' order by id"
case 5 'IP查询
sqlcx="select * from ip where ip_address like '%"&request.Form("cxnr")&"%' order by id"
case 6 'MAC查询
sqlcx="select * from ip where mac_address like '%"&request.Form("cxnr")&"%' order by id"
case 7 '未分配IP查询
'sqlcx="update ip set user_name=''"
sqlcx="select * from ip where user_name='' and ip_address<>'' order by id desc"
end select
%>
<table width="743" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h3><img src="images/address.png" width="16" height="16"> IP地址信息
</h3></td>
</tr>
<tr>
<td><div align="center">
<form name="form2" method="post" action="ip.asp?action=ipfind">
<label>
查询方式:
<select name="cxfs" id="cxfs">
<option value="1">所有数据记录</option>
<option value="2">按机构名查询</option>
<option value="3">所属部门查询</option>
<option value="4">按使用者查询</option>
<option value="5">按IP地址查询</option>
<option value="6">MAC 地址查询</option>
<option value="7">未分配IP查询</option>
</select>
</label>
<label></label>
<label>请输入查询内容:
<input name="cxnr" type="text" id="cxnr" size="40">
</label>
<label>
<input type="submit" name="Submit" value="查询">
</label>
</form>
</div></td>
</tr>
</table>
<%
If request.Form("cxfs")<>"" then
if session("s_rights")="" or isnull(session("s_rights"))=true then
Response.Write("<script language=javascript>alert('登录超时,请重新登录!');parent.location.href='../login.asp';</script>")
end if
rs.PageSize = 12 '这里设定每页显示的记录数
rs.CursorLocation = 3
rs.Open sqlcx,conn,0,2,1
pre = true
last = true
page = trim(Request.QueryString("page"))
if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs.eof then
rs.AbsolutePage = intpage
end if
if rs.eof and rs.bof then Response.Write("<script language=javascript>alert('没有找到您要找的记录,点击确定显示已分配IP记录!');location.href='ip.asp';</script>") end if
%>
<table width="743" border="1" cellpadding="0" cellspacing="0"
bordercolorlight="#000000" bordercolordark="#FFFFFF" class="set">
<tr class="top">
<td width="33">ID</td>
<td width="102">机构</td>
<td width="112">部门</td>
<td width="65">使用者</td>
<td width="160">IP地址</td>
<td width="200" align="center">操作</td>
</tr>
<!--循环开始-->
<%for i=1 to rs.PageSize
if rs.EOF or rs.BOF then exit for %>
<tr class="mid">
<td><% =rs("id")%></td>
<td><%if rs("branch_name") <> "" then%><% =rs("branch_name")%><%else%><font color="#006600"> <%end if%></td>
<td><%if rs("Departments") <> "" then%><% =rs("Departments")%><%else%><font color="#006600"> <%end if%></td>
<td><%if rs("user_name") <> "" then%><% =rs("user_name")%><%else%><font color="#006600"> <%end if%></td>
<td><%if rs("ip_address") <> "" then%><% =rs("ip_address")%><%else%><font color="#006600"> <%end if%></td>
<td align="center">
<a href="ip.asp?action=view&id=<% =rs("id")%>"> [查看]</a>
<a href="ip.asp?action=news"> [添加]</a>
<a href="ip.asp?action=edit&id=<% =rs("id")%>"> [修改]</a>
<a href="ip.asp?action=clear&id=<% =rs("id")%>"> [清空]</a>
<a href="ip.asp?action=del&id=<% =rs("id")%>"> [删除]</a>
</td>
</tr>
<%
rs.movenext
next
'wend
%>
</table>
<!--循环体结束分页部分:-->
<table width="743" border="0" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff class="set">
<tr>
<%if rs.pagecount > 0 then%>
<td width="21%" align="center">
<p align="left">当前页<%=intpage%>/<%=rs.PageCount%> | 每页 <%=rs.PageSize%> 条记录</td>
<%else%>
<td width="16%" align="center">
<p align="left">当前页0/0</td><%end if%>
<td width="59%" align="center">
<p align="right"> <a href="ip.asp?action=ipfind&page=1">首页</a>|
<%if pre then%>
<a href="ip.asp?page=<%=intpage -1%>">上页</a>|<%end if%>
<%if last then%>
<a href=ip.asp?action=ipfind&page="<%=intpage +1%>">下页</a>|<%end if%>
<a href="ip.asp?page=<%=rs.PageCount%>">尾页</a>| 转到第
<select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = intpage then%>
<option value="ip.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="ip.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页 </td>
</tr>
</table>
<%
end if
end sub
dim i,intPage,page,pre,last,filepath,sqlcx,cx_cxfs,sql
set rs = Server.CreateObject("ADODB.RecordSet")
cx_cxfs=request.Form("cxfs")
cx_cxnr=request.Form("cxnr")
select case cx_cxfs
case 1 '所有数据
sqlcx="select * from ip order by id,branch_name"
case 2 '机构查询
sqlcx="select * from ip where branch_name like '%"&request.Form("cxnr")&"%' order by id"
case 3 '部门查询
sqlcx="select * from ip where Departments like '%"&request.Form("cxnr")&"%' order by id"
case 4 '使用者查询
sqlcx="select * from ip where user_name like '%"&request.Form("cxnr")&"%' order by id"
case 5 'IP查询
sqlcx="select * from ip where ip_address like '%"&request.Form("cxnr")&"%' order by id"
case 6 'MAC查询
sqlcx="select * from ip where mac_address like '%"&request.Form("cxnr")&"%' order by id"
case 7 '未分配IP查询
'sqlcx="update ip set user_name=''"
sqlcx="select * from ip where user_name='' and ip_address<>'' order by id desc"
end select
<table width="743" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h3><img src="images/address.png" width="16" height="16"> IP地址信息
</h3></td>
</tr>
<tr>
<td><div align="center">
<form name="form2" method="post" action="ip.asp?action=ipfind">
<label>
查询方式:
<select name="cxfs" id="cxfs">
<option value="1">所有数据记录</option>
<option value="2">按机构名查询</option>
<option value="3">所属部门查询</option>
<option value="4">按使用者查询</option>
<option value="5">按IP地址查询</option>
<option value="6">MAC 地址查询</option>
<option value="7">未分配IP查询</option>
</select>
</label>
<label></label>
<label>请输入查询内容:
<input name="cxnr" type="text" id="cxnr" size="40">
</label>
<label>
<input type="submit" name="Submit" value="查询">
</label>
</form>
</div></td>
</tr>
</table>