include "functions.inc"; include "theme.inc"; $theme->header(); $terms = stripslashes($terms); $output .= "
\n"; $output .= " | \n"; $output .= "||
\n";
### Compose query:
$query = "SELECT DISTINCT s.id, s.subject, u.userid, s.timestamp FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.status = 2 ";
if ($terms != "") $query .= "AND (s.subject LIKE '%$terms%' OR s.abstract LIKE '%$terms%' OR s.comments LIKE '%$terms%') ";
if ($category != "") $query .= "AND s.category = '$category' ";
if ($author != "") $query .= "AND u.userid = '$author' ";
if ($order == "Oldest first") $query .= " ORDER BY s.timestamp ASC";
else $query .= " ORDER BY s.timestamp DESC";
### Perform query:
$result = db_query("$query");
### Display search results:
$output .= " \n"; while ($entry = db_fetch_object($result)) { $num++; if ($user) { $link = "id"; if (isset($user->umode)) { $link .= "&mode=$user->umode"; } else { $link .= "&mode=threaded"; } if (isset($user->uorder)) { $link .= "&order=$user->uorder"; } else { $link .= "&order=0"; } if (isset($user->thold)) { $link .= "&thold=$user->thold"; } else { $link .= "&thold=0"; } $link .= "\">$entry->subject"; } else { $link = "id&mode=threaded&order=1&thold=0\">$entry->subject"; } $output .= " $num) $link Your search did not match any articles in our database:
$num results matched your search query. \n"; $output .= " | \n";
$output .= "