⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search.php

📁 FTB安装版 v1.3(虚拟形象)FTB安装版 v1.3(虚拟形象)
💻 PHP
字号:
<?
$forumid1=102;
require("userdata/style.php");
require("global.php");
$fid=$forumid;
if($forumid>0&&$forumid<100) $fb="<a href=thread.php?forumid=$forumid>$forum_name</a> >> <a href=search.php>搜索程式</a>";else $fb="<a href=search.php>搜索程式</a>";
$style="style=\"background-color:#FEFEFF; color:#5A6633; border: 1 double #B4B4B4\"";
$style2="style=\"background-color:#FEFEFF; color:#666666; border: 1 double #B4B4B4\"";
$add_title=" &gt; 搜索程式";
if ($login_status !=1) {
	require("header.php");echo"$headertp";
	headguide('你现在正在<br>'.$bbs_title.'<br>的搜索程式程式中',$fb,'','no');
msg_box('对不起!!','<center>你还没有登陆或注册,暂时不能使用搜索功能!!<br><ul><li><a href="register.php">现在注册</a></li><br><li><a href="login.php">现在登录</li></ul></center>');
require("footer.php");echo"$footertp";
        exit;}

if (empty($keyword)) {
//---------input keyword---------
	require("header.php");echo"$headertp";
if (empty($page)) $page=1;
headguide('你现在正在<br>'.$bbs_title.'<br>的搜索程式程式中',$fb,'','no');

	print_form();
	require("footer.php");echo"$footertp";
	exit;
}
$check=1;
if (strlen($keyword)<=1) {
	require("header.php");echo"$headertp";
if (empty($page)) $page=1;
headguide('你现在正在<br>'.$bbs_title.'<br>的搜索程式中',$fb,'','no');

	print_err();
	require("footer.php");echo"$footertp";
	exit;
}

if($step!=2) print_seaching();

$keyword= str_replace(",",",",$keyword);
$keyword=safe_convert($keyword);
$keyword_list=explode(",",$keyword);
$keyc=count($keyword_list);
if (empty($forumid) || $forumid=="all") {
	$forumlist=file("bbsdata/forumdata.php");
	$fcount=count($forumlist);
	for ($i=0; $i<$fcount; $i++) {
		$detail=explode("|",$forumlist[$i]);
		if ($detail[0]!="category") $forumtosearch[]=$detail[3];
	}
}
	else $forumtosearch[]=$forumid;
	
$fcount=count($forumtosearch);

if (empty($page)) $page=1;
if (empty($method)) $method="or";

$maxresult=($page*$perpage);
$resultcount=0;
$more=0;
for ($i=0; $i<$fcount; $i++) {
	if(file_exists("{$idpath}forum$forumtosearch[$i]/list.php")) $listtosearch=file("{$idpath}forum$forumtosearch[$i]/list.php");
	

	$lcount=count($listtosearch);
	for ($j=0; $j<$lcount; $j++) {
		//-------or搜索-------------
		
list($title,$author,$date,$des,$icon,$filename,$reply,$hit,$last_mod_data,$islock,$topic_type,$jihua)=explode("|",$listtosearch[$j]);

$qbbb=0;
if (!file_exists("{$idpath}forum$forumtosearch[$i]/$filename")) $qbbb=1;
if($method2) {
$lmd=explode(",",$last_mod_data);
$lmd[2] =     trim($lmd[2]);
$limitdate=$method2*86400;
$t=time();
 if ($t-$lmd[2]>=$limitdate) $qbbb=1;
}
if($qbbb==0){


if($method1=="1")  $seaf=$title;
elseif($method1=="2")  $seaf=$author;

else $seaf=readfromfile("{$idpath}forum$forumtosearch[$i]/$filename");}



if ($method=="or" && $qbbb==0) {



			for ( $k = 0; $k < $keyc; $k++) 
				
			if ( strpos($seaf, $keyword_list[$k] ) !== false ) {
					$result[] = array($listtosearch[$j],$forumtosearch[$i]);
					$resultcount++;
					break;
				}
				
				
				
				}
		
		//-------and搜索------------
		elseif ($method=="and" && $qbbb==0) {
			$bypass = 1;
			for ( $k = 0; $k < $keyc; $k++) {
            if ( strpos( $seaf , $keyword_list[$k] ) === false ) {
					$bypass=0;
					break;
				
				}



				
			}
			if ( $bypass==1 ) {
				$result[] = array($listtosearch[$j],$forumtosearch[$i]);
				$resultcount++;
			}
		}
	if ($resultcount==$maxresult) {$more=1; break;}
	}
if ($resultcount==$maxresult) break;
}

if (empty($result)) {
	require("header.php");echo"$headertp";if (empty($page)) $page=1;
headguide('你现在正在<br>'.$bbs_title.'<br>的搜索程式中',$fb,'搜索"'.$keyword.'"','no');

	print_none();
	require("footer.php");echo"$footertp";
	exit;
}

//-----显示结果-------
require("header.php");echo"$headertp";if (empty($page)) $page=1;
headguide('你现在正在<br>'.$bbs_title.'<br>的搜索程式中',$fb,'搜索"'.$keyword.'"','no');
sline_search(); ?>
<table cellspacing=0 cellpadding=0 height=23 width=<?=$tablewidth?> align=center border=1 bgcolor=<?=$titlecolor?> bordercolor=<?=$bordercolor?>>
  <tr align=center> 
    <td width=90 background=images/<?=$style_path?>/title_back.gif><b class=title>版&nbsp;块</b></td>
    <td width=* background=images/<?=$style_path?>/title_back.gif><b class=title>主&nbsp;&nbsp;题</b> (点心情符为开新窗浏览)</td>
    <td width=85 background=images/<?=$style_path?>/title_back.gif><b class=title>作 者</b></td>
    <td width=32 background=images/<?=$style_path?>/title_back.gif><b class=title>回复</b></td>
    <td width=32 background=images/<?=$style_path?>/title_back.gif><b class=title>点击</b></td>
    <td width=195 background=images/<?=$style_path?>/title_back.gif><b class=title>最后参与 | 参与者</b></td>
  </tr>
</table>
<?
$maxresult=min($maxresult,$resultcount);
for ($i=max(0,$maxresult-$perpage); $i<$maxresult; $i++) {
	list($a_info,$forumid)=$result[$i];
	articleline();
}
?>
<table cellspacing=2 cellpadding=0 width=<?=$tablewidth?> align=center border=0>
  <tr height=4></tr>
  <tr> 
    <td align=left>搜索信息:
<?
echo " 已经搜索到了 $resultcount 条信息";
      $nextpage=$page+1;
      $previouspage=$page-1;
if ($more) echo " --- [ <a href='search.php?keyword=$keyword&page=$nextpage&method=$method&method1=$method1&method2=$method2&forumid=$fid'>搜索下 $perpage 个结果</a> ]";
if ($page>1) echo " [ <a href='search.php?keyword=$keyword&page=$previouspage&method=$method&method1=$method1&method2=$method2&forumid=$fid'>返回上 $perpage 个结果</a> ]";
?></td></tr></table>
<br>
<?
require("footer.php");echo"$footertp";
exit;
function sline_search() {
global $bordercolor,$tablewidth;
print ("<table cellspacing=0 cellpadding=0 width=$tablewidth align=center bgcolor=$bordercolor border=0><tr><td height=1></td></tr></table>");
}
function articleline() {
global $a_info,$forumid,$list_color1,$list_color2,$bordercolor,$backgroundcolor,$username,$titlefontcolor,$tablewidth,$timestamp,$keyword;
list($title,$author,$date,$des,$icon,$filename,$reply,$hit,$last_mod_data,$islock,$topic_type)=explode("|",$a_info);
$forumlist11=file('bbsdata/forumdata.php');
$count11=count($forumlist11);
for ($io=0; $io<$count11; $io++) {
  $deta=explode('|',$forumlist11[$io]);
  if ($deta[3]==$forumid) $forumInfo=$deta[1]; }
 if (strlen($author)>=12) $viewauthor=substr($author,0,9)."...";
	else $viewauthor=$author;

if ($author==$username) $mypost="<img src='images/system/mypost.gif' border=0 width=14 height=14>";
else $mypost="&nbsp;";
if ($topic_type==1) {
	$stats="<img src='images/system/statistic.gif'>";
	if ($islock==1) $stats="<img src='images/system/closesta.gif'>";
} elseif ($topic_type==2) {
	$stats="<img src='images/system/ucommend.gif' >";
	if ($islock==1) $stats="<img src='images/system/closeu.gif'>";
} elseif ($topic_type>=3) {
	$stats="<img src='images/system/holdtopic.gif'>";
} else {
	if ($username!=$author) {
		$stats="<img src='images/system/topicnew.gif'>";
		if ($reply>=10) $stats="<img src='images/system/topichot.gif'>";
		if ($islock==1) $stats="<img src='images/system/topiclocked.gif'>";
	} else {
		$stats="<img src='images/system/mytopicnew.gif'>";
		if ($reply>=10) $stats="<img src='images/system/mytopichot.gif'>";
		if ($islock==1) $stats="<img src='images/system/mytopiclocked.gif'>";
	}
}

if (strlen($title)>=40) $title=substr($title,0,37)."...";
$keywords=explode(",",$keyword);
$kwcount=count($keywords);
for($kw=0;$kw<$kwcount;$kw++){
$title =str_replace($keywords[$kw],"<font color=red>".$keywords[$kw]."</font>",$title);
$viewauthor =str_replace($keywords[$kw],"<font color=red>".$keywords[$kw]."</font>",$viewauthor);
}
$title="<a target=_blank href='read.php?forumid=$forumid&filename=$filename&keyword=$keyword'\">$title</a>";
$lmd=explode(",",$last_mod_data);
$g=$timestamp-$lmd[2];
if ($g<=3600) $title.='<img src="images/system/newred.gif" >';
elseif ($g<=(3600*24)) $title.='<img src="images/system/newblue.gif" >';
elseif ($g<=(3600*48)) $title.='<img src="images/system/newgreen.gif" >';
if ($lmd[2]==$date) $lmdauthor="------";
else {
$lat=$lmd[1];
$keywords=explode(",",$keyword);
$kwcount=count($keywords);
for($kw=0;$kw<$kwcount;$kw++){
$lat =str_replace($keywords[$kw],"<font color=red>".$keywords[$kw]."</font>",$lat);
}
$lmdauthor="<a target=_blank href=\"profile.php?job=show&target=$lmd[1]\">$lat</a>";
}
$lmdtime=get_date($lmd[2]).' '.get_time($lmd[2]);
print ("
<table cellspacing=0 cellpadding=0 width=$tablewidth align=center border=1 bordercolor=$bordercolor>
<tr align=center height=25 bgcolor=$list_color1>
<td width=90>$forumInfo</td>
<td width=* bgcolor=$list_color2 align=left>&nbsp;$title</td>
<td width=85 ><a target=_blank href=\"profile.php?job=show&target=$author\">$viewauthor</a></td>
<td width=32 bgcolor=$list_color2>$reply</td>
<td width=32 bgcolor=$list_color2>$hit</td>
<td width=195 align=left>&nbsp; &nbsp;{$lmdtime}&nbsp;<font color=#000066>|</font>&nbsp;$lmdauthor</td>
</tr>
</table>
");
}
function print_form() {
global $subcolor,$bordercolor,$titlecolor,$tablewidth,$backgroundcolor,$titlefontcolor,$forumid,$style_path;
?>
<table width=<?=$tablewidth?> border=0 cellspacing=0 cellpadding=0 align=center bgcolor=<?=$bordercolor?>>
<form action="search.php" method=post>
<tr>
<td>
<table width=100% border=0 cellspacing=1 cellpadding=3 align=center>
<tr>
<td bgcolor=<?=$titlecolor?> height=25><font color=<?=$titlefontcolor?>>搜索程式</font></td>
</tr>
<tr bgcolor=<?=$backgroundcolor?>> 
<td>
<br>
请输入关键字:
<input type=text name=keyword $style2 size=30 onMouseOver = "this.style.backgroundColor = '#f3f3f3'" onMouseOut = "this.style.backgroundColor = ''">
(1个字节以上,关键字用逗号分开)
<br>
<br>
选择搜索方式:
<input type=radio name="method" value="or" checked>
OR方式搜索 
<input type=radio name="method" value="and">
AND方式搜索
	
<br>
<br>
选择搜索版块: 

<select name=forumid>
<?
$forumlist=file("bbsdata/forumdata.php");
$count=count($forumlist)-1;
for ($i=0; $i<=$count; $i++) {
	$forum_list_info=explode("|",$forumlist[$i]);
	if ($forumid==$forum_list_info[3]) $ifcheck="selected";else $ifcheck="";
	if ($forum_list_info[0]!="category"){
		if ($forum_list_info[4]==0) echo "<OPTION value=\"$forum_list_info[3]\" $ifcheck>$forum_list_info[1]</OPTION>";
		else echo "<OPTION value=\"$forum_list_info[3]\" $ifcheck>&nbsp;|- $forum_list_info[1]</OPTION>";
	}
}
?>
<OPTION value="all">全部版块</OPTION>
</select>
	<br>
	<br>
选择搜索范围:
<select name=method1>

<?//<OPTION value="6">搜索贴子内容和作者</OPTION>?>
<OPTION value="1">只搜索主题</OPTION>
<OPTION value="2">只搜索首贴作者</OPTION>
<?//<OPTION value="3" >只搜索首贴(主题,作者,内容)</OPTION>
//<OPTION value="4">只搜索作者(包括回贴作者)</OPTION>
//<OPTION value="5">只搜索贴子内容(只是内容,不能搜作者)</OPTION>?>
<OPTION value="7">搜索所有的一切</OPTION>
</select>
<br><br>
选择搜索时间:
<select name=method2>
<OPTION value="60">二个月内的贴子</OPTION>
<OPTION value="1">一天内的贴子</OPTION>
<OPTION value="7">一星期内的贴子</OPTION>
<OPTION value="30">一个月内的贴子</OPTION>
<OPTION value="90">三个月内的贴子</OPTION>
<OPTION value="">搜索全部贴子</OPTION>
		</select>(包括新贴和回复贴)
</td>
</tr>
<tr align="center">
<td bgcolor=<?=$titlecolor?>>
<input type="submit" value="开始搜索" style="height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">
&nbsp;
<input type="reset" value="清除重写" style="height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<?
}
function print_err() {
msg_box('SEARCH 搜索程式','
<br>
哎呀,你也真是调皮也<br>
<br>
刚才不是说了么 ~~~~ 长度要大于1<br>
<ul>
<li><a href="javascript:history.back(1);">返回前页</a></li>
</ul>');
}
function print_none() {
global $subcolor,$bordercolor,$titlecolor;
msg_box('SEARCH 搜索程式','
<br>
有没有搞错....... <br>
<br>
一条结果也没有 <br>
<ul>
<li><a href="javascript:history.back(1);">返回前页</a></li>
</ul>');
}
function print_seaching(){
global $keyword,$method,$method1,$method2,$fid,$page;
jump_page("search.php?keyword=$keyword&method=$method&method1=$method1&method2=$method2&forumid=$fid&step=2&page=$page","正在搜索,请稍候....");
}

⌨️ 快捷键说明

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