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

📄 searnch.php

📁 php蓝狐文章管理系统
💻 PHP
字号:
<? require "./inc/header.inc";?>
 <script language="javascript">
function opwin(filename)
    {
        window.open("read_article.php?id="+filename,"","height=500,width=585,resizable=no,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
     }
</script>
</head>
<body bgcolor="#FFFFFF">
<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
  <TBODY>
  <TR>
    <TD vAlign=top noWrap bgColor=#c0c0c0><FONT color=#000000>
      <DIV class=nav><a href="index.php"><FONT
      color=#000000>主页</FONT></a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="help.htm"><FONT
      color=#000000>帮助</FONT></a>&nbsp;
      </DIV></FONT>
    </TD>
  </TR>
  </TBODY>
</TABLE>
<?
require"./inc/func.php";
mscon();?>
<?
if($submit)
{
$key=trim($key);
if(!empty($key))
 {
 switch ($whe)
  {
   case 1:
             $wher="cont like '%$key%'";
         break;
   case 2:
            $wher=" title like '%$key%'";
        break;
   case 3:
           $wher=" time like '%$key%'";
        break;
   default:
           $wher=" title like '%$key%' or type like '%$key%' or cont like '%$key%' or time like '%$key%'";
        break;
  }
if($type)
$query="select * from $table where type='$type' and($wher ) order by time desc";
else
$query="select * from $table where $wher order by time desc";
$res=mysql_db_query("$database",$query);
if(mysql_num_rows($res)>0)
{              ?>
<TABLE cellSpacing=0 cellPadding=4 width="100%" border=0>
  <TBODY>
  <TR>
      <TD vAlign=top noWrap bgColor=#009900><FONT color=#ffffff>&nbsp;共找到:<?=mysql_num_rows($res);?>条记录</FONT></TD>
    </TR><?
    $num=1;
while($data=mysql_fetch_array($res))
  {
   $data[type]=str_replace($key,"<font color=red>$key</font>",$data[type]);
   $data[title]=str_replace($key,"<font color=red>$key</font>",$data[title]);
   $data[cont]=htmlspecialchars($data[cont]);
   $data[cont]=str_replace($key,"<font color=red>$key</font>",$data[cont]);

   $data[time]=str_replace($key,"<font color=red>$key</font>",$data[time]);
 ?>     <tr><td>
         <DL>
          <DT><B>
            <? echo $num;?>
            </B> <a href=# onclick=opwin(<? echo $data[id];?>)><B>
           <?echo $data[title];?></B></A>  -  <font size=1>
           <?echo "[$data[type]]"; if($data[comm]==1)
          echo "<img src=\"./images/comm.gif\" alt=\"精品文章\">";if($data[locked]==1) echo "<img src=\"./images/locked.gif\" alt=\"文章已锁定\">";?>
          </font>
          <DD>
            <?echo nl2br(substr($data[cont],0,300)."......");?>
            <BR>
            加入时间:
            <?echo $data[time]?>
            <BR>
            <BR>
          </DD>
        </DL>
        <P></P>
        </FONT>   </td></tr>
   <?
   $num++;
   }

}
else
{
echo "对不起,暂时没有相关文章!";
}
}
else
 {
  echo "<br>请输入您要查询的关键字!";

 }
}
?>     </table>
<FORM name=form1 action=searnch.php  method=post>
    <input type="text" name="key">
  <select name="type">
  <option value=>全部类别</option>
<? $typ=file("list.txt");
$num=count($typ);
for($i=2;$i<=$num;$i++)
{
  echo"<option value=$typ[$i]>$typ[$i]</option>";}
      ?>
        </select>
        <select name="whe">
  <option value=>全部内容</option>
  <option value=1>文章内容</option>
  <option value=2>文章标题</option>
  <option value=3>加入时间</option>
        </select>
  <input type="submit" name="submit" value="提交查询">
       </FORM>
<?require "./inc/footer.inc";?>

⌨️ 快捷键说明

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