📄 search.php
字号:
<?
require("head.php");
require("config.php");
require("xqfunc.php");
if (empty($keyword)){
head_form();
$msg="您没有填写关键词";
$turn_page="javascript:history.back(1);";
error_0($msg,$turn_page);
exit;
}
############################以下为按照指定分类搜索###############################################
if ($searchtype!="all"){
$file_sort=file("data/"."xq.php");
$file_count=count($file_sort)-1;
////////
////////////////////按指定分类--标题搜索//////////////////////////////////////////////
if ( $title and $keyword and empty($text)) {
$user=file("data/$searchtype/list.php");
$user_count=count($user);
for ($i=0;$i<$user_count;$i++){
$user_array =explode("|", $user[$i]);
$SEARCH_IDX[]=$user_array[0];
}
$Bad_Keyword_Array = array("?", " ", "[", "]", "(", ")", "+", "\\", "|", "$");
for ($q = 0 ; $q < sizeof($Bad_Keyword_Array); $q++)
{
if (strstr($keyword, $Bad_Keyword_Array[$q])) {
$keyword = "";
}
}
/////////////////////////////////////////
$end =count($SEARCH_IDX);
for($sss=0; $sss<=$end-1; $sss++) {
$search_file = chop($SEARCH_IDX[$sss]);
if( is_file("data/$searchtype/$search_file.num") and is_file("data/$searchtype/$search_file.txt")) {
$FILES_ARRAY_DATA = file("data/$searchtype/$search_file.num");
$FILES_ARRAY = explode("|", $FILES_ARRAY_DATA[0]);
if ( eregi($keyword, $FILES_ARRAY[1])) {
$IDX[] = $search_file;
}
}
}
}
////////////////////////按照指定分类--内容搜索//////////////////////
if ( $text and $keyword and empty($title)) {
$user=file("data/$searchtype/list.php");
$user_count=count($user);
for ($i=0;$i<$user_count;$i++){
$user_array =explode("|", $user[$i]);
$SEARCH_IDX[]=$user_array[0];
}
$Bad_Keyword_Array = array("?", " ", "[", "]", "(", ")", "+", "\\", "|", "$");
for ($q = 0 ; $q < sizeof($Bad_Keyword_Array); $q++)
{
if (strstr($keyword, $Bad_Keyword_Array[$q])) {
$keyword = "";
}
}
///////////////////
$end =count($SEARCH_IDX);
for($sss=0; $sss<=$end-1; $sss++) {
$search_file = chop($SEARCH_IDX[$sss]);
if( is_file("data/$searchtype/$search_file.num") and is_file("data/$searchtype/$search_file.txt")) {
$FILES_ARRAY_DATA = file("data/$searchtype/$search_file.txt");
if ( eregi($keyword, $FILES_ARRAY_DATA[0])) {
$IDX[] = $search_file;
}
}
}
}
/////////////////////////按照指定分类综合搜索//////////////////////
if ( $text and $keyword and $title) {
$user=file("data/$searchtype/list.php");
$user_count=count($user);
for ($i=0;$i<$user_count;$i++){
$user_array =explode("|", $user[$i]);
$SEARCH_IDX[]=$user_array[0];
}
$Bad_Keyword_Array = array("?", " ", "[", "]", "(", ")", "+", "\\", "|", "$");
for ($q = 0 ; $q < sizeof($Bad_Keyword_Array); $q++)
{
if (strstr($keyword, $Bad_Keyword_Array[$q])) {
$keyword = "";
}
}
$end =count($SEARCH_IDX);
for($sss=0; $sss<=$end-1; $sss++) {
$search_file = chop($SEARCH_IDX[$sss]);
if( is_file("data/$searchtype/$search_file.num") and is_file("data/$searchtype/$search_file.txt")) {
$FILES_txt_DATA = file("data/$searchtype/$search_file.txt");
$FILES_num_DATA = file("data/$searchtype/$search_file.num");
$FILES_num_code = explode("|", $FILES_num_DATA[0]);
if ( eregi($keyword, $FILES_num_code[1]) or eregi($keyword, $FILES_txt_DATA[0])) {
$IDX[] = $search_file;
}
}
}
}
$total_search=count($IDX);
$recnum = $page_list_pg;
$listnum = 10;
$totalnum = intval(($total_search)/$recnum)+1;
///////////////
echo "<title>文章管理</title>\n";
echo "<center>\n";
echo "<br><table border=0 bgcolor=\"$main_color\" cellspacing=1 cellpadding=3 width=735>\n";
echo "<tr bgcolor=$main_color>\n";
echo "<td class=shadow2>\n";
echo "<img src=./images/dot.gif>\n";
echo "<a class=shadow2 href=index.php>文章首页</a> \n";
for ($i=0;$i<=$file_count;$i++) {
$file_name=explode("|",$file_sort[$i]);
if ($file_name[0]=="form")
echo "<img src=./images/dot.gif>"." <a class=shadow2 href=listform.php?form=$file_name[1]>$file_name[2]"."</a>\n";
if ($file_name[1]==$searchtype)
$msg.=" <img src=./images/dottype.gif> $file_name[2]";
}
echo "</td>\n";
echo "</tr>\n";
echo "<tr bgcolor=$fuse_color>\n";
echo "<td class=shadow2>\n";
echo ">>$msg-文章搜索结果\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
//////////////////////////////////////////////////////
echo "<table border=0 cellpadding=10 cellspacing=0 style='border-collapse:collapse' bordercolor=$main_color width=735>\n";
echo "<tr>\n";
echo "<td class=shadow2 valign=bottom>\n";
echo "<img src=images/list.gif> 取得文章总数/搜索文章分类:<b><font color=red>$total_search</font>/$end</b>";
echo "</td>\n";
echo "</td>\n";
echo "<form method='post' action='search.php'>";
echo "<td align=right valign=bottom>\n";
echo "<img src='./images/search.gif' width=16 heigth=16> ";
echo "标题<input type=checkbox name=title value='1' ";
echo ">\n";
echo "内容<input type=checkbox name=text value='1' ";
echo ">\n";
echo "<input class=border type=text name=keyword size=12 style='color:#000000; background-color:$fuse_color'>\n";
echo "<select size=1 name=searchtype style='color:#000000; border-style:solid; border-width:1; background-color:$fuse_color'>\n";
echo "<option value='all'>-=所有文章=-</option>";
for ($i=0;$i<=$file_count;$i++) {
$file_name=explode("|",$file_sort[$i]);
if ($file_name[0]=="type"){
echo "<option value=".$file_name[1].">".$file_name[2]."</option>";
} }
echo "</select> \n";
echo "<input class=border type=submit value=搜索 name=search style='color: #000000; background-color: $main_color'>\n";
echo "</td>";
echo"</form>";
echo "</tr>\n";
echo "</table>\n";
echo "<table border=0 cellspacing=0 style='border-collapse:collapse' width=735 height=233 cellpadding=3>\n";
echo "<tr>\n";
echo "<td width=60% height=233 valign=top>\n";
/////////////将搜索结果分页显示//////////////////////////////
echo "<table border=1 cellpadding=3 cellspacing=0 style='border-collapse:collapse' bordercolor=$biankuang_color width=100%>\n";
echo "<tr>\n";
echo "<td width=100% align=right class=shadow2>\n";
page_menu($totalnum);
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<center><table border=0 bgcolor=\"white\" cellspacing=1 cellpadding=1 width=100%>\n";
if ( !$p ) { $p = 1; }
for ($i = $total_search-(($p-1)*$recnum)-1; $i > $total_search-($p*$recnum)-1;$i--) {
if ( "$IDX[$i]" && "$IDX[$i]" != '.' && "$IDX[$i]" != '..') {
$user=file("data/$searchtype/$IDX[$i].num");
$xqfile_info=explode("|",$user[0]);
$len = strlen($xqfile_info[1]);
if ($len <= $page_list_code)
$title_new = $xqfile_info[1];
else
$title_new =substr($xqfile_info[1],0,$page_list_code)."...";
$NO=$i+1;
echo "<tr><td width=22 height=\"22\"align=center bgcolor=\"$fuse_color\" onmouseover=\"this.bgColor='white';\" onmouseout=\"this.bgColor='$fuse_color';\">";
echo "$NO</td>";
echo "<td height=\"22\" bgcolor=\"white\" onmouseover=\"this.bgColor='$fuse_color';\" onmouseout=\"this.bgColor='white';\">";
echo "</b><a target=_blank href='show.php?type=$searchtype&id=$xqfile_info[0]'><span style=font:9pt>$title_new</span></a>";
if (!empty($xqfile_info[5])) {
$FILE = split("\.", $xqfile_info[5]);
$FILE_count=count($FILE);
$ftype = GET_FILE_TYPE($FILE[$FILE_count-1]);
echo ".<a href=\"artdown.php?type=$searchtype&id=$xqfile_info[0]\" target=blank><IMG border=0 SRC='images/file/$ftype'></a>/$xqfile_info[19]\n";
}
if ($xqfile_info[2]!="")
echo " - <font color=#c0c0c0>$xqfile_info[2]/文 </font>";
$xqfile_time=explode(" ",$xqfile_info[6]);
echo "<font color=#c0c0c0>$xqfile_time[0]</font><br>";
} }
echo "</td>\n";
echo "</tr>\n";
echo "</table></center>\n";
if ($total_search==0)
echo" <img src=./images/dot1.gif>共搜索<font color=red>".$end."</font>篇文章,没有找到符合搜索条件的文章";
elseif ($total_search>0)
echo" <img src=./images/dot1.gif>共搜索<font color=red>".$end."</font>篇文章,搜索到个<font color=red>".$total_search."</font>符合条件";
echo "<table border=1 cellpadding=3 cellspacing=0 style='border-collapse:collapse' bordercolor=$biankuang_color width=100%>\n";
echo "<tr>\n";
echo "<td width=100% align=right class=shadow2>\n";
page_menu($totalnum);
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</td>\n";
echo "<td width=40% valign=top>\n";
/////////////////////////////本类最新文章//////////////////////////////////////////////////
echo "<table border=0 bgcolor=\"$main_color\" cellspacing=1 cellpadding=1 width=100%>\n";
echo "<tr>\n";
echo "<td width=100% bgcolor=$main_color>\n";
echo "<img src='./images/search2.gif' width=16 heigth=16> 本类最新文章\n";
echo "</td>\n";
echo "</tr>\n";
$file_new_sort=file("data/$searchtype".".new");
$file_new_count=count($file_new_sort)-1;
for ($i=$file_new_count;$i>=$file_new_count-$page_list_new+1;$i--) {
$file_new_name=explode("|",$file_new_sort[$i]);
if ( "$file_new_name[0]" && "$file_new_name[0]" != '.' && "$file_new_name[0]" != '..') {
$file_new_array=file("data/$file_new_name[1]/$file_new_name[0].num");
$file_new_info=explode("|",$file_new_array[0]);
$len = strlen($file_new_info[1]);
if ($len <= $new_hot_code)
$title_new = $file_new_info[1];
else
$title_new =substr($file_new_info[1],0,$new_hot_code)."...";
echo "<tr><td align=left bgcolor=\"white\" onmouseover=\"this.bgColor='$fuse_color';\" onmouseout=\"this.bgColor='white';\">";
echo "<img src=./images/dot1.gif> <a target=_blank href=show.php?type=$searchtype&id=$file_new_info[0]>$title_new</a>\n";
$file_time=explode(" ",$file_new_info[6]);
echo "<font color=#c0c0c0>-$file_time[0]</font>";
echo "<br>";
echo "</td>\n";
echo "</tr>\n";
}
}
echo "</table>\n";
echo "<br>\n";
/////////////////////本类热门文章/////////////////////////////////////////////////////////
echo "<table border=0 bgcolor=\"$main_color\" cellspacing=1 cellpadding=1 width=100%>\n";
echo "<tr>\n";
echo "<td width=100% bgcolor=$main_color>\n";
echo "<img src='./images/search2.gif' width=16 heigth=16> 本类热门文章\n";
echo "</td>\n";
echo "</tr>\n";
$file_new_sort=file("data/$searchtype".".hot");
$file_new_count=count($file_new_sort)-1;
for ($i=$file_new_count-$page_list_new+1;$i<=$file_new_count;$i++) {
$file_new_name=explode("|",$file_new_sort[$i]);
if ( "$file_new_name[0]" && "$file_new_name[0]" != '.' && "$file_new_name[0]" != '..') {
$file_new_array=file("data/$file_new_name[1]/$file_new_name[0].num");
$file_new_info=explode("|",$file_new_array[0]);
$len = strlen($file_new_info[1]);
if ($len <= $new_hot_code)
$title_new = $file_new_info[1];
else
$title_new =substr($file_new_info[1],0,$new_hot_code)."...";
echo "<tr><td align=left bgcolor=\"white\" onmouseover=\"this.bgColor='$fuse_color';\" onmouseout=\"this.bgColor='white';\">";
echo "<img src=./images/dot1.gif> <a target=_blank href=show.php?type=$searchtype&id=$file_new_info[0]>$title_new</a>\n";
echo "<font color=#c0c0c0>阅:</font><font color=red>$file_new_info[16]/$file_new_info[17]</font>";
echo " <font color=#c0c0c0>评:$file_new_info[18]</font>";
echo "<br>";
echo "</td>\n";
echo "</tr>\n";
}
}
echo "</table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<TR > <TD colspan='2' vAlign=top width='100%'><P align=right class=small><A href='http://qiji.wo.to'></A></P></TD></TR></TBODY></TABLE></DIV></TD></TR>";
echo "</table>\n";
echo "<hr width=735 color=$biankuang_color>";
require("foot.php");
############################以下为全站搜索###############################################
}else{
if ( $title and $keyword and empty($text)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -