Location: PHPKode > projects > WBBlog > inc/search.inc.php
<?/*

WBBlog - Single User Blog
Version 1.0
Michael Lintz - LIQUA Web Solutions
hide@address.com - http://www.liqua.com
Copyright (C) 2005 

This program is free software; you can redistribute it and/or modify it under the terms of 
the GNU General Public License as published by the Free Software Foundation; either version 
2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; 
if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

*/?>

<?php if (isset($cmd) && $cmd == "search"): ?>
 


<?
include 'head.inc.php';
?> 
 
<? 
if($_POST['good']=='yes') 
{ 
   ?>
   
   <table class='ContentTitle'>
    <tr>
    <td>Search Results for "<? echo  $words; ?>"</td>
    </tr>
  </table>
  <br />   
   
   <?
   
   $mysql_row = "e_content";
   $query = "ALTER TABLE $db_searchtable ORDER BY e_id DESC"; 
   $result = mysql_query($query); // bad coding yes ;)

   $query = "SELECT * FROM $db_searchtable"; 
   $result = mysql_query($query); 
   $numrows = mysql_num_rows($result); 
   while($row = mysql_fetch_array($result)){ 

   if(preg_match("/$words/i", $row[$mysql_row]))
   { 


      $newdate = date('n/d/y',strtotime($row[e_timestamp]));
      
      $rawid = ($row[e_id]); 
      $rawtitle = ($row[e_title]);
      $rawauthor = ($row[e_author]); //T just grab extra data to be added with the search tool
      $newnews = preg_replace("/$words/i", "<b><font color=\"red\">$words</font></b>", $row[$mysql_row]); 
    
      ?>
      
      <strong><a href=index.php?cmd=viewentry&e_id=<? echo $rawid; ?>><? echo $rawtitle; ?></a></strong> - <i class='NumEntry'>Posted on <? echo $newdate; ?></i><br />
      
      <?
     
      $foundcount++; 
   } 
   $totalcount++; 
   } 
if(is_null($foundcount)){$foundcount=0;} 
echo("<br /><br />Found $foundcount entries out of $totalcount"); 
} 
?>


<?php endif; ?>
Return current item: WBBlog