<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "provider=microsoft.jet.oledb.4.0;data source = " &  Server.MapPath("dataasdfsd3fvdfsdfdsfd787fsdfsdsdgfsdg/7dataasdfsd3fvdfsdfdsfd787fsdfsdsdgfsdg.mdb")
'dim keywords,keywords2,stype,rs
%>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>搜索</title></head><body leftmargin="0" topmargin="0"><br>
<div align="center">
<table width="750" border="0" cellpadding="0" cellspacing="1" bgcolor="#4C9DFE"><tr>
<td bgcolor="#3179CE" colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="3"><tr>
<td width="100%"><strong><font color="#FFFFFF">贴吧查询页面:全文搜索 </font></strong></td></tr></table></td></tr><tr>
<td bgcolor="#4C9DFE" colspan="3">
<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td width="1%">&nbsp; </td>
<td width="65%" valign="top" style="font-size: 11pt"><%
keywords=trim(request("keywords"))
keywords2="<b><font color=red>"&trim(request("keywords"))&"</font></b>"
stype=trim(request("stype"))
if stype="" then
stype=1
end if
if keywords="" then
response.write"请不从外部提交数据！请返回http://www.chaotie.com重新查询"
Response.Redirect "index.asp"
response.end
end if
set rs=server.CreateObject("adodb.recordset")
select case stype
case 2
rs.open "select * from Dv_bbs1 where Topic like '%"&keywords&"%' ",conn,1,1
case 1
On Error Resume Next
rs.open "select * from Dv_bbs1 where Body like '%"&keywords&"%' ",conn,1,1
end select%>
<%
    If Err.Number <> 0 Then
  '清除页面
  Response.Clear
        '显示错误信息给用户 
   %>
    <HTML>
  <HEAD>
  <TITLE></TITLE>
  </HEAD>
        <BODY BGCOLOR="#C0C0C0">
对不起，您查询的留言内容没有找到，请重新查询！ </BODY>
    </HTML>

<%else
if rs.recordcount<>"0" then 
if rs.recordcount="1" then 
if stype="1" then
%>
<font color="#FFFFFF">您输入的关键字是：</font><b><font color="#FF0000"><%=keywords%></font>
<font color="#FFFFFF">,系统为您找到一篇留言，点击打开：<br>　　<a target="_blank" href=dispbbs.asp?boardid=<%=rs("boardid")%>&ID=<%=rs("Rootid")%>&replyid=<%=rs("announceID")%>&page=1><%=Replace(rs("Body"),keywords,keywords2)%></a></font></td>
<% Response.Redirect "dispbbs.asp?boardid="&rs("boardid")&"&ID="&rs("Rootid")&"&replyid="&rs("announceID")&"&page=1" %>
<%else%> 
<font color="#FFFFFF">贴吧名称：</font><b><font color="#FF0000"> <%=keywords%> </font>
<font color="#FFFFFF">,仅查询到一个相关内容,进入<a  target="_blank" href=index.asp?boardid=<%=rs("boardid")%>><%=Replace(rs("Body"),keywords,keywords2)%></a></font></td>
<%
end if
else%>
<font color="#FFFFFF">查询关键字：</font><font color="#FF0000"> <%=keywords%> </font>
<font color="#FFFFFF">,共找到</font><font color="#FF0000"> <%=rs.recordcount%> </font><font color="#FFFFFF">个相关内容：</font></td>


<td width="31%"></td><td width="2%" align=right>　</td></tr></table></td></tr><tr>
<td colspan="3"><table width="97%" border="0" align="center" cellpadding="5" cellspacing="1"><tr><td bgcolor="#C0C0C0">序号</td><td bgcolor="#E8F5FF">留言标题</td><td bgcolor="#C0C0C0">作者</td><td bgcolor="#E8F6FF">留言或回复时间</td></tr><tr><%
dim cou1
cou1=0
do while not rs.eof
cou1=cou1+1
%> <tr><%
for j=1 to 1
if rs.eof then
response.write"<td bgcolor=#E8F5FF></td>"
else
%><td bgcolor="#C0C0C0"><%=cou1%></td> <td bgcolor="#E8F5FF" valign="top">
<a target="_blank" href=dispbbs.asp?boardid=<%=rs("boardid")%>&ID=<%=rs("Rootid")%>&replyid=<%=rs("announceID")%>&page=1>
<% if rs("Topic")="" then %>留言回复“<%=keywords%>”
<%else%>
<%=Replace(rs("Topic"),keywords,keywords2)%>
<%end if%></a> </td><td width="80" bgcolor="#C0C0C0"><%=rs("UserName")%></td><td width="160" bgcolor="#E8F5FF"><%=rs("DateAndTime")%></td><%
rs.movenext
end if
next
%> </tr><%
if rs.eof then exit do
rs.movenext
loop
%> <%end if%>
</tr></table></td></tr><%else%>
对不起，您输入的留言标题“<%=keywords%>”在整个贴吧都未找到,<br>您可以尝试再次查找或<a href="Dv_plus/userboard.asp?action=add&keywords=<%=keywords%>">点此新建</a>相关贴吧<%end if%><tr><td width="16" height="30"> </td>
<td width="402" height="30"><%
rs.close
set rs=nothing
%><%End If%>
<form name="urlsearch" method="post" action="2url_search.asp">
<font color="#FFFFFF">重新查询:</font><select name="stype" id="stype">
<option value="1" selected>按留言内容</option><option value="2">按留言标题</option>

</select><input name="keywords" type="text" value="<%=keywords%>" size="15" maxlength="40" onClick=javascript:this.value=""> <input class=button_index  type="button" name="bub" value="搜 索" onClick="checksea()"> <script language="VBScript">
<!---
function checksea()
if urlsearch.keywords.value="" or urlsearch.keywords.value="关键字" then
msgbox"请正确输入要搜索的留言内容关键字！"
urlsearch.keywords.focus
else
urlsearch.submit
end if
end function
-->
</script></td>
<td width="351" height="30"></form>
</td>
</tr></table></div>
</body></html>