foreach ($body as $bk => $bv) { if (ereg($qv, $bv)) { $body[$bk] = str_replace($bv, "<span style=\"color: #{$color}; font-size: 18px; font-family: Tahoma\">" . $bv . "</span>", $body[$bk]); } } } echo implode(" ", $body), "</p><p>Tags: ", $current_meta["tags"], ", Written By: ", $current_meta["author"], "</p></div></div>"; } } echo "Search took <strong>", substr($search->time(), 0, 6), "s</strong> and found <strong>", $search->num_results(), "</strong> results<br />"; break; case "roots": $results = $search->find_roots($query); $size = sizeof($results); print_r(mysql_fetch_array(mysql_query("SELECT id FROM zombie_roots WHERE LOWER(name) LIKE '%{$query}%' OR LOWER(mail) LIKE '%{$query}%'"))); foreach ($results as $key) { $current = Root::get($key); echo "<div class=\"search_result\">"; echo "<h2><a href=\"roots.php?id=", $current["id"], "\">", $current["name"], "</a></h2><p><span>", $current["mail"], "</span></p>"; echo "</div>"; } echo "Search took <strong>", substr($search->time(), 0, 7), "s</strong> and found <strong>", $search->num_results(), " results</strong><br />"; break; } } ?> </div> </body> </html> <?php mysql_close($con);
$query = $_GET["query"]; $search = new Search(); switch ($type) { case "blog": $results = $search->find_articles($query); $index = 0; echo "<ul>"; foreach ($results as $key) { $current = mysql_fetch_array(mysql_query("SELECT head, subh FROM articles WHERE id = '{$key}'")); echo "<li>", $current["head"], "<br /><span class=\"informal\">", $current["subh"], "</span></li>"; $index++; if ($index == 5) { break; } } echo "<ul>"; break; case "roots": $results = $search->find_roots($query); echo "<ul>"; foreach ($results as $key) { $current = Root::get($results[0]); echo "<li>", $current["name"], "<br /><span class=\"informal\">", $current["mail"], "</span></li>"; } echo "</ul>"; break; default: echo "<ul><li>Search for {$type} is not implemented yet</li></ul>"; break; } mysql_close($con);