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

📄 search.php

📁 这是一个新闻管理的软件
💻 PHP
字号:
<?
if($keyword== "")
{
	header("Location:index.php");
}
else
{
	if(!file_exists("searchcount.dbf")) fclose(fopen("searchcount.dbf","w"));
	$currentcount = file("searchcount.dbf");
	$handle = fopen("searchcount.dbf","w");
	fputs($handle,($currentcount[0]+1));
	fclose($handle);
		
	$tmpdata = file("downloadata.php");
	if($lowcase != "yes")$keyword=strtolower($keyword);
	if($searchtype != "所有内容")
	{
		for($i=1;$i<count($tmpdata);$i++)
		{
			$tmp = split("\|\|",$tmpdata[$i],99);
			if($searchtype == $tmp[0])
			{
				$downloadata[1]=$tmpdata[$i];
				$downloadata[2]="";
				$foundsign=1;
			}
		}
		if($foundsign != 1)
			header("Location:index.php");
	}
	else
		$downloadata = $tmpdata;
	$total = 0;
	for($i=1;$i<count($downloadata);$i++)
	{
		$type = split("\|\|",$downloadata[$i],99);
		$id	= $type[0];
		$idcn	= $type[1];
		$message = file("$id/$id.php");
		$subtotal = chop($message[0]);
		for($j=1;$j<=$subtotal;$j++)
		{
			if(!file_exists("$id/$j.php"))continue;
			$submessage = file("$id/$j.php");
			if(($searchtitle == "yes") || ($searchtitle=="subid")) $totalsubmessage = 1;
			else $totalsubmessage = count($submessage);
			for($k=0;$k<$totalsubmessage;$k++)
			{
				if($lowcase != "yes")$submessage[$k]=strtolower($submessage[$k]);
				if(ereg($keyword,$submessage[$k]))
				{
					$tmpmsg = split("\|\|",$submessage[$k],99);
					if($searchtitle == "yes")
					{
						if($searchright == "yes")
						{
							if($tmpmsg[0] == $keyword)
							{
								$foundmsg[$total]=$id."||".$idcn."||".$j."||".$submessage[0]."||".$tmpmsg[3]."||";
								$total++;
								break;
							}
						}
						else if(ereg($keyword,$tmpmsg[0]))
						{
							$foundmsg[$total]=$id."||".$idcn."||".$j."||".$submessage[0]."||".$tmpmsg[3]."||";
							$total++;
							break;
						}
					}
					else if($searchtitle == "subid")
					{
						if($searchright == "yes")
						{
							if($tmpmsg[3] == $keyword)
							{
								$foundmsg[$total]=$id."||".$idcn."||".$j."||".$submessage[0]."||".$tmpmsg[3]."||";
								$total++;
								break;
							}
						}
						else if(ereg($keyword,$tmpmsg[3]))
						{
							$foundmsg[$total]=$id."||".$idcn."||".$j."||".$submessage[0]."||".$tmpmsg[3]."||";
							$total++;
							break;
						}
					}
					else
					{
						$foundmsg[$total]=$id."||".$idcn."||".$j."||".$submessage[0]."||".$tmpmsg[3]."||";
						$total++;
						break;
					}
				}
			}
		}
	}

?>
<html>
<head>
<title>文章搜索</title>
<meta http-equiv="目录类型" content="文本/html; 字符集=gb2312">
<link rel="stylesheet" type="text/css" href="../default.css">
</head>

<body bgcolor="#FFFFFF" leftmargin="4" topmargin="4">
<center>
<table width="770" border="0" cellspacing="0" cellpadding="0">
  <tr> 
      <td width="176" height="60" valign="top"><img src="../image/php2000.gif" width="176" height="60" border=0 alt="PHP世纪网"></td>
      <td width="468" height="70" align="center" valign="top"> 
        <p> <a href="http://easytoad.com/cgi-bin/banner.cgi?action=url&user=php2000" target="_blank"> <img width="468" height="60" src="http://easytoad.com/cgi-bin/banner.cgi?action=img&user=php2000&target=Comp" border="0"></a> </p>
    </td>
    <td height="60" valign="top"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr align="center"> 
          <td> 
            <script>document.write("<a href=http://top1.263.net/count/top.dll?Type=sharkpwd&id=A7908&ReferID=A7908 target=_blank>");document.write("<img src=http://top1.263.net/count/top.dll?Type=Img5&add=1&id=A7908&refer="+escape(top.document.referrer)+" border=0  alt=263统计计数器>");document.write("</a>");</script>
          </td>
        </tr>
        <tr align="center"> 
          <td><? print(date("Y年m月d日")); ?> </td>
        </tr>
        <tr align="center"> 
          <td>-_-</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
  <table width="770" border="0" cellspacing="0" cellpadding="2" bgcolor="99cc99">
    <tr align="center"> 
      
			<td width="10%">◆<a href="../index.html">主页</a></td>
      <td width="10%">◆<font color="#FF0000">文章教程</font></td>
      
   <td width="10%">◆<a href="../my/index.php">站长作品</a></td>
      <td width="10%">◆<a href="../freecode/index.php">代码共享</a></td>
      <td width="10%">◆<a href="../bbs/index.php">PHP 论坛</a></td>
      <td width="10%">◆<a href="../homepage/javascript/index.htm">网页制作</a></td>
      <td width="10%">◆<a href="../../download/index.htm">软件下载</a></td>
    </tr>
  </table>
  <table width="770" border="0" cellspacing="0" cellpadding="0">
    <tr align="right"> 
      
			<td height="16"><? print("<a href=show.php?id=$id>".$id."</a>"); ?> &lt;&lt; <a href="index.php">文章教程</a> &lt;&lt; <a href="../index.html">主页</a></td>
    </tr>
  </table>
  <table width="770" border="0" cellspacing="0" cellpadding="0">
    <tr valign="middle"> 
      <td height="10" align="center"><img src="../image/linepoint.gif" width="100%" height="1"></td>
    </tr>
    <tr valign="top"> 
      <td> <?
if($showdetail != "yes")
{
?> 
        <table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolorlight="808080" bordercolordark="f0f0f0" bgcolor="f0f0f0">
          <tr bgcolor="99cc99"> 
            <td colspan="5" align="center"><? print("搜索关键词:".$keyword); ?></td>
          </tr>
          <tr bgcolor="99cc99"> 
            <td colspan="5" align="center"><?print($searchtype)?>共找到<? print($total); ?>个</td>
          </tr>
          <tr bgcolor="d0d0d0"> 
            <td align="center" width="50">编号</td>
            <td align="center" width="100">类别</td>
            <td align="center" width="150">子类别</td>
            <td align="center" width="420">文章标题</td>
            <td align="center" width="50">人气</td>
          </tr>
          <?
	for($i=0;$i<$total;$i++)
	{
		$msg = split("\|\|",$foundmsg[$i],99);
		$id	= $msg[0];
		$idcn	= $msg[1];
		$name	= $msg[2];
		$title	= $msg[3];
		$date	= $msg[4];
		$times	= $msg[5];
		$subid	= $msg[6];
		if( ($subid == "") || ($subid == "\r\n")) $subid="-";

?> 
          <tr> 
            <td align="center"><?print($i+1);?></td>
            <td align="center"><?print("<a href=show.php?id=$id>$idcn</a>");?></td>
            <td align="center"><?print($subid)?></td>
            <td><? print("<a href=show.php?id=$id&&name=$name&&showdetail=yes>".$title."</a>"); ?></td>
            <td align="center"><? print($times); ?></td>
          </tr>
          <?
	}
?> 
          <tr bgcolor="99cc99"> 
            <td colspan="5" align="center">&nbsp;</td>
          </tr>
        </table>
        <?
}
else
{
	$msg[$name][3]++;
	$message = file("$id/$name.php");
	$handle = fopen("$id/$name.php","w");
	$msg = split("\|\|",$message[0],99);
	$msg[2]++;
	fputs($handle,$msg[0]."||".$msg[1]."||".$msg[2]."||\r\n");
	for($i=1;$i<count($message);$i++)
	{
		fputs($handle,$message[$i]);
	}
	fclose($handle);
?> 
        <table width="100%" border="0" cellspacing="0" cellpadding="10">
          <tr> 
            <td> <? 
	print("<center>".$msg[0]."<br>".$msg[1]."</center><p>");
	for($i=1;$i<count($message);$i++)
	{
		$message[$i] = ereg_replace("<","&lt;",$message[$i]);
		$message[$i] = ereg_replace(">","&gt;",$message[$i]);
		$message[$i] = ereg_replace("\r\n","<br>",$message[$i]);	
		$message[$i] = ereg_replace("&&php3000&&","\\",$message[$i]);
		$message[$i] = ereg_replace("&&php2000&&","\"",$message[$i]);
		$message[$i] = ereg_replace("&&php1000&&","'",$message[$i]);
		print(stripslashes($message[$i]));
	}
?></td>
          </tr>
        </table>
        <?
}
?> </td>
    </tr>
  </table>
  <center>
    <? include("bottom.php") ?> 
  </center>
</center>
</body>
</html>
<?
}
?>

⌨️ 快捷键说明

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