36 |
list($topictext, $topicimage) = getTopic($topic); |
list($topictext, $topicimage) = getTopic($topic); |
37 |
include('header.php'); |
include('header.php'); |
38 |
html_page_head(); |
html_page_head(); |
39 |
echo "<div align=\"center\"><font size=\"4\"><b>Sök i $topictext</b></font></div><br>\n"; ?> |
echo "<div align=\"center\"><font size=\"4\"><b>Sök i $topictext</b>" |
40 |
|
. "</font></div><br>\n"; |
41 |
|
?> |
42 |
|
|
43 |
<table width="100%" border="0"> |
<table width="100%" border="0"> |
44 |
<tr><td> |
<tr><td> |
85 |
</form></td></tr></table><p> |
</form></td></tr></table><p> |
86 |
<? |
<? |
87 |
if ($type == "stories" or !$type) { |
if ($type == "stories" or !$type) { |
88 |
$q = "SELECT s.sid, s.aid, s.title, s.time, a.url, s.comments, s.topic FROM stories s, authors a WHERE s.aid=a.aid "; |
$q = "SELECT s.sid, s.aid, s.title, s.time, a.url, s.comments, s.topic " |
89 |
if (isset($query)) $q .= "AND (s.title LIKE '%$query%' OR s.hometext LIKE '%$query%' OR s.bodytext LIKE '%$query%' OR s.notes LIKE '%$query%') "; |
. "FROM stories s, authors a WHERE s.aid=a.aid "; |
90 |
|
if (isset($query)) |
91 |
|
$q .= "AND (s.title LIKE '%$query%' " |
92 |
|
. "OR s.hometext LIKE '%$query%' " |
93 |
|
. "OR s.bodytext LIKE '%$query%' " |
94 |
|
. "OR s.notes LIKE '%$query%') "; |
95 |
if ($author) $q .= "AND s.aid='$author' "; |
if ($author) $q .= "AND s.aid='$author' "; |
96 |
if ($topic) $q .= "AND s.topic='$topic' "; |
if ($topic) $q .= "AND s.topic='$topic' "; |
97 |
if ($days) $q .= "AND TO_DAYS(NOW()) - TO_DAYS(time) <= $days "; |
if ($days) $q .= "AND TO_DAYS(NOW()) - TO_DAYS(time) <= $days "; |
102 |
$x = 0; |
$x = 0; |
103 |
echo "<table width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"; |
echo "<table width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"; |
104 |
if ($nrows > 0) { |
if ($nrows > 0) { |
105 |
while(list($sid, $aid, $title, $time, $url, $comments, $topic) = mysql_fetch_row($result)) { |
while(list($sid, $aid, $title, $time, $url, $comments, $topic) = |
106 |
$result2 = mysql_query("SELECT topictext FROM topics WHERE topicid='$topic'"); |
mysql_fetch_row($result)) { |
107 |
list($topictext) = mysql_fetch_row($result2); |
$sql = "SELECT topictext FROM topics WHERE topicid='$topic'"; |
108 |
$furl = "article.php?sid=$sid$rmflags"; |
$result2 = mysql_query($sql); |
109 |
formatTimestamp($time); |
list($topictext) = mysql_fetch_row($result2); |
110 |
printf("<tr><td><font size=3><a href=\"%s\"><b>%s</b></a> <font size=\"2\"> av <a href=\"%s\">%s</a>",$furl,$title,$url,$aid); |
$furl = "article.php?sid=$sid$rmflags"; |
111 |
print " den $datetime <b>($comments)</b></td></tr>\n"; |
formatTimestamp($time); |
112 |
$x++; |
printf("<tr><td><font size=3><a href=\"%s\"><b>%s</b></a>" |
113 |
|
."<font size=\"2\"> av <a href=\"%s\">%s</a>", |
114 |
|
$furl,$title,$url,$aid); |
115 |
|
print " den $datetime <b>($comments)</b></td></tr>\n"; |
116 |
|
$x++; |
117 |
} |
} |
118 |
echo "</td></tr></table>\n"; |
echo "</td></tr></table>\n"; |
119 |
} else { |
} else { |
120 |
echo "<div align=\"center\"><font color=\"Red\">Inga träffar på din sökning.</font></div><br><br>"; |
echo "<div align=\"center\"><font color=\"Red\">"; |
121 |
echo "</td></tr></table>\n"; |
echo "Inga träffar på din sökning.</font></div><br><br>"; |
122 |
|
echo "</td></tr></table>\n"; |
123 |
} |
} |
124 |
$prev = $min - $offset; |
$prev = $min - $offset; |
125 |
if ($prev >= 0) { |
if ($prev >= 0) { |