📄 find.asp
字号:
<%@ language=vbscript %>
<!--#include file="config.asp"-->
<!--#include file="conn.inc"-->
<%
response.buffer=true
%>
<%
name=session("username")
key = request.form("key")
topic=request.form("topic")
if key="" then
response.write"<script language='javascript'>"
response.write"alert('您没有输入查询关键词!');"
response.write"history.go(-1);"
response.write"</script>"
response.end
end if
if topic="0"then
sql="SELECT * from mis where name like '%"&key&"%' or addr like '%"&key&"%' or oicq like '%"&key&"%'or sex like '%"&key&"%'or phone like '%"&key&"%' "
'---------查询name,addr字段中含有 关键字的记录
'---------%是什么意思
end if
if topic="1" then
sql="SELECT * from mis where name like '%"&key&"%'"
end if
if topic="2" then
sql="SELECT * from mis where sex like '%"&key&"%'"
end if
if topic="3" then
sql="SELECT * from mis where phone like '%"&key&"%'"
end if
if topic="4" then
sql="SELECT * from mis where addr like '%"&key&"%' "
end if
if topic="5" then
sql="SELECT * from mis where oicq like '%"&key&"%' "
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,3
'----------rs 中始终只有一个当前记录,rs中保存所有符合条件的记录,并将游标指想第一个符合条件的记录
if rs.eof then
response.write"<script language='javascript'>"
response.write"alert('没有符合您要求的记录!');"
response.write"history.go(-1);"
response.write"</script>"
response.end
end if
total=rs.recordcount
%>
<html>
<head>
<title>找到<%=total%>条记录</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="config.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" background="bg01.gif">
<SCRIPT language="javascript">
function show(url)
{
var loginWin = window.open(url,"_blank","top=10,left=10,height=300,width=360,toolbar=0,location=0,directories=0,menubar=0,scrollbars=1,resizable=0,status=0");
}
</script>
<form name="form1" method="post" action="find.asp">
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="center"><b><font color="#0066FF"><%=name%> 共找到<font color=red><%=total%></font>条符合您要求的记录
<hr noshade color="green" size="1">
</font></b></div>
</td>
</tr>
</table>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="40" height="8">编号</td>
<td width="160" height="8">姓名</td>
<td width="330" height="8">地址</td>
<td width="100" height="8">电话</td>
<td width="80" height="8">oicq</td>
<td width="40" height="8">性别</td>
</tr>
<tr>
<td colspan="6" height="9">
<hr noshade color="#cccccc" size="1">
</td>
</tr>
</table>
<!-- Start -->
<%
do while not rs.eof
i=i+1
name=rs("name")
sex=rs("sex")
oicq=rs("oicq")
addr=rs("addr")
phone=rs("phone")
userid=rs("id")
%>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="40"><font color="red"><%=i%></font></td>
<td width="160"><a href='javascript:show("list.asp?id=<%=userid%>")'><%=name%></a></td>
<td width="330"><%=addr%></td>
<td width="100"><%=phone%></td>
<td width="80"><%=oicq%></td>
<td width="40"><%=sex%></td>
</tr>
</table>
<table width="750" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<hr noshade size="1" color="#cccccc">
</td>
</tr>
</table>
<%
rs.movenext
loop
%>
<br>
<table width="75%" border="0" align="center">
<tr>
<td>
<div align="center">
<select name="topic">
<option value="1">按姓名搜</option>
<option value="2">按性别搜</option>
<option value="3">按电话搜</option>
<option value="4">按地址搜</option>
<option value="5">按oicq搜</option>
<option value="0" selected>智能搜索</option>
</select>
关键词:
<input type="text" name="key">
<input type="submit" name="Submit2" value="给我搜">
</div>
</td>
</tr>
</table>
</form><br>
<table width="75%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolor="#999999" bordercolorlight="#999999" bordercolordark="#f7f7f7">
<tr>
<td height="9" bgcolor="#CCCCCC">
<div align="center"><%=titlemark%>通讯录管理中心</div>
</td>
</tr>
<tr>
<td>
<div align="center"><a href="log.asp">登陆</a>---<a href="input.asp">加入通讯录</a>---<a href="index.asp">查看全部</a>---<a href="guestbook/index.asp" target="_blank">留言板</a>---个人资料管理---<a href="ad_log.asp">超级管理员入口</a></div>
</td>
</tr>
</table>
<br>
<!--#include file="foot.asp"-->
</body>
</html>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -