<% '################################################################# '# china power board /cpb / 动力论坛 # '# 电子邮件: feiyueziwo@sohu.com # '# 主页地址: http://www.pwsite.net # '# 论坛地址:http://bbs.pwsite.net # '# 程序制作:(动力工作室)飞越 # '# 最后修改日期: 2003/4/20 # '# Copyright 2003 http://www.pwsite.net - All Rights Reserved # '################################################################# %> <% if h_viewcpb=1 and isuser=false then response.redirect("login.asp") dim h_search sql="select h_search from home" set rsconn1=conn.execute(sql) if not rsconn1.eof then h_search=rsconn1("h_search")'允许游客搜索字段 end if set rsconn1=nothing if h_search=2 then errornum=1 errormsg="
  • 很抱歉,搜索已经被管理员关闭
  • " elseif h_search=1 and isuser=false then errornum=1 errormsg="
  • 很抱歉,客人不允许搜索论坛帖,请先注册或者登陆
  • " end if cpbtitle="搜索论坛" if errornum=1 then call toptitle(l_title,cpbtitle) call head(4,"论坛信息",Request.ServerVariables("HTTP_REFERER"),cpbtitle) call error(errormsg) call login() else call toptitle(l_title,cpbtitle) call head(4,"论坛信息",Request.ServerVariables("HTTP_REFERER"),cpbtitle)%> cellPadding=4 cellSpacing=1 width=<%=tdc3%> style="border-collapse: collapse" align=center> <%dim key,username,title,lanmu,sdate,fstring,key2,key1,maxpagecount,r,rcount if Request("action")="search" then username=chktopic(request("username")) key=chktopic(request("key")) title=chktopic(request("title")) lanmu=chktopic(request("lanmu")) sdate=chktopic(request("sdate")) function gao(fString) key2=split(lcase(key), "|") for i = 0 to ubound(key2) fString = Replace(fString, key2(i), ""&key2(i)&"") next fString = Replace(fString, "'","") gao=fstring end function function gao1(fString) key2=split(lcase(username), "|") for i = 0 to ubound(key2) fString = Replace(fString, key2(i), ""&key2(i)&"") next fString = Replace(fString, "'","") gao1=fstring end function set rs = server.createobject("adodb.recordset") '搜索用户 if username <>"" then page=request.querystring("page") if page="" then page=1 end if pages = "25" key1=split(username, "|") if ubound(key1)>0 then sql = "select grade.g_title,user.username,user.u_todaytime,user.fen,user.send,user.home,user.email,user.u_beauty,user.u_money,user.lastsendtime,user.time from user,grade where int(user.grade)=grade.g_num and (" for i=0 to ubound(key1) sql=sql&" user.username like '%"&key1(i)&"%' or" next sql=left(sql,len(sql)-3) sql=sql&" )" else sql = "select grade.g_title,user.username,user.u_todaytime,user.fen,user.send,user.home,user.email,user.u_beauty,user.u_money,user.lastsendtime,user.time from user,grade where int(user.grade)=grade.g_num and user.username like '%"&username&"%'" end if rs.open sql,conn,1,1 if not(rs.BOF or rs.EOF) then rs1=conn.execute("select count(*) from user where username like '%"&username&"%'") r=rs1(0) if r mod pages=0 then maxpagecount= r \ pages else maxpagecount= r \ pages+1 end if RS.MoveFirst if int(page) > maxpagecount then page = maxpagecount if int(page)<1 then page=1 RS.Move (page-1) * pages rcount=0 %> <% do while not rs.eof and rcount <% rs.MoveNext rcount=rcount+1 loop set rs=nothing %> <%else errormsg="
  • 找不到您要的用户,请返回重新搜索
  • " call error(errormsg) end if%>
    class=tdc1 height=23>用户名 class=tdc1>发帖数 class=tdc1>经验 class=tdc1>财产 class=tdc1>魅力 class=tdc1>注册时间 class=tdc1>等级 class=tdc1>Email class=tdc1>主页 class=tdc1>短消息
    class=tdc style="Word-Break:Break-all">" target=_blank><%=gao1(rs("username"))%>  class=tdc><%=rs("send")%>  class=tdc><%=rs("fen")%>  class=tdc><%=rs("u_money")%>  class=tdc><%=rs("u_beauty")%>  class=tdc><%=rs("time")%>  class=tdc><%=rs("g_title")%>  class=tdc> <%if rs("u_todaytime")=0 then%> >按此发邮件给<%=rs("username")% src="image/email.gif" border=0> <%else response.write("隐藏") end if%> class=tdc><%if rs("home")<>""then%> " target=_blank> 访问<%=rs("username")%的主页 src="image/homepage.gif" border=0><% else response.write("无") end if%> class=tdc> ">按此发论坛短信给<%=rs("username")% src="image/pm.gif" border=0 >
    class=tdc > <% pagestart=page-5 pageend=page+5 if pagestart<1 then pagestart=1 if pageend>maxpagecount then pageend=maxpagecount response.write(" [ ") if maxpagecount > 6 then Response.Write ("1 ... ") for i=pagestart to pageend if i<>int(page) then Response.Write (" " & i & " ") else Response.Write (""&i&" ") end if next if maxpagecount > page +5 then Response.Write( " ... "&maxpagecount&"") response.write(" ] ") response.write("..页次:"&page&"/"&maxpagecount&"页 每页:"&pages&" 用户数:"&r&" ")%>  
    <% '搜索主题 elseif key <> "" and username ="" then %> cellPadding=4 cellSpacing=0 width=<%=tdc3%> style="border-collapse: collapse" align=center> <% page=request.querystring("page") if page="" or page=0 then page=1 pages = "20" key1=split(key, "|") if title=1 or title=2 then sql="select top 1000 topic.t_username,topic.t_id,topic.l_id,topic.t_replynum,topic.t_lastusername,topic.t_title from topic where topic.t_lock<>2 and " if title=1 then sql=sql&" (" if ubound(key1)>0 then for i=0 to ubound(key1) sql=sql&" topic.t_title like '%"&key1(i)&"%' or" next sql=left(sql,len(sql)-3) else sql=sql &" topic.t_title like '%"&key&"%'" end if sql=sql&" )" elseif title=2 then sql=sql&" (" if ubound(key1)>0 then for i=0 to ubound(key1) sql=sql&" topic.t_username like '%"&key1(i)&"%' or" next sql=left(sql,len(sql)-3) else sql=sql &" topic.t_username like '%"&key&"%'" end if sql=sql&" )" end if elseif title=3 or title=4 then sql="select top 1000 topic.t_username,topic.t_id,topic.l_id,topic.t_replynum,topic.t_lastusername,topic.t_title from topic,reply where topic.t_lock<>2 and topic.t_id=reply.t_id and" sql=sql&" (" if ubound(key1)>0 then for i=0 to ubound(key1) sql=sql&" reply.r_title like '%"&key1(i)&"%'" if title=4 then sql=sql &" or reply.r_content like '%"&key1(i)&"%'" sql=sql&" or" next sql=left(sql,len(sql)-3) else sql=sql&" reply.r_title like '%"&key&"%'" if title=4 then sql=sql &" or reply.r_content like '%"&key&"%'" end if sql=sql&" )" elseif title=6 then sql="select top 1000 topic.t_username,topic.t_id,topic.l_id,topic.t_replynum,topic.t_lastusername,topic.t_title from topic,reply where topic.t_lock<>2 and topic.t_id=reply.t_id and (topic.t_username like '%"&key&"%' or reply.r_username like '%"&key&"%')" else sql="select top 1 t_username from topic where t_username='cpbfy'" end if if sdate<>0 then sql=sql&" and t_time>#"&dateadd("d", -sdate, nowtime) & "#" if lanmu<>"0" and (title=6 or title=3 or title=4 )then sql=sql &" and topic.l_id="&lanmu&"" elseif lanmu<>"0" then sql=sql &" and l_id="&lanmu&"" end if rs.open sql,conn,1,1 if not(rs.BOF or rs.EOF) then r=cint(rs.RecordCount)'记录总数 if r mod pages=0 then maxpagecount= r \ pages else maxpagecount= r \ pages+1 end if RS.MoveFirst if int(page) > maxpagecount then page = maxpagecount if int(page)<1 then page=1 RS.Move (page-1) * pages rcount=0 %> <% do while not rs.eof and rcount <% rs.MoveNext rcount=rcount+1 loop set rs=nothing %> <%else errormsg="
  • 找不到你要的结果,请返回重新搜索
  • " call error(errormsg) end if%> <% elseif key = "" and username ="" then errormsg="
  • 请输入关键字查找,请返回重新搜索
  • " call error(errormsg) end if%>
    class=tdc1>作者 class=tdc1>主题 class=tdc1>回复数 class=tdc1>最新回复
    class=tdc>" target=_blank><%=rs("t_username")%>  class=tdc>&t_id=<%=rs("t_id")%> title=<%=HTMLEncode(rs("t_title"))%>><%=gao(left(HTMLEncode(rs("t_title")),30))%>...  class=tdc><%=rs("t_replynum")%>  class=tdc><%=rs("t_lastusername")%> 
    class=tdc > <% pagestart=page-5 pageend=page+5 if pagestart<1 then pagestart=1 if pageend>maxpagecount then pageend=maxpagecount response.write(" [ ") if maxpagecount > 6 then Response.Write ("1 ... ") for i=pagestart to pageend if i<>int(page) then Response.Write (" " & i & " ") else Response.Write (""&i&" ") end if next if maxpagecount > page +5 then Response.Write( " ... "&maxpagecount&"") response.write(" ] ") response.write("..页次:"&page&"/"&maxpagecount&"页 每页:"&pages&" 记录数:"&r&" ")%>  
    <% Elseif Request.QueryString("action")="" then%> cellPadding=0 cellSpacing=0 width=<%=tdc3%> style="border-collapse: collapse" align=center>
    cellPadding=4 cellSpacing=1 width=100% style="border-collapse: collapse">
    class=tdc1 height="22">搜索论坛中的帖子
    class=tdc height="23">你要搜索的关键字: class=tdc height="23">  (多个关键字请用|分开)
    class=tdc height="23">选择需要搜索的论坛: class=tdc height="23">  (如果选择带+的,相当于选择所有论坛)
    class=tdc height="23">选择搜索范围: class=tdc height="23">  
    class=tdc height="23">选择搜索时间: class=tdc height="23">  
    class=tdc height="23"> 搜索用户: class=tdc height="23">  (多个关键字请用|分开)
    class=tdc>  class=tdc>
    <%end if%> <%end if%>