Файл: user/sforum.php
Строк: 43
<?
include '../connect.php';
$location = '(Использует поиск по форуму)';
include '../head.php';
switch ($_GET['act']) {
case search:
echo '<div class="title">';
echo '<img src="/ico/forum.png" alt="!"/> <a href = "/forum.php">Форум</a> <b>Поиск</b>';
echo '</div>';
if (isset($_POST['ok'])) {
$s = check($_POST['s']);
if (empty($s)) {
header('Location: sforum.php?act=search');
} else {
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_themes` WHERE `name` LIKE '%$s%'"), 0);
if($all > 0){
$total = intval(($all - 1) / $count) + 1;
$page = num($_GET['page']);
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $count - $count;
$result = mysql_query("SELECT * FROM `forum_themes` WHERE `name` LIKE '%$s%' ORDER BY `id` LIMIT $start, 10");
while($theme = mysql_fetch_assoc($result)) {
echo $i % 2 ? '<div class="div">' : '<div class="div">';
$end = mysql_query("SELECT `user`,`time` FROM `forum_themes` WHERE `id` = '".$theme['id']."' ORDER BY `fix` DESC");
$end_msg = mysql_fetch_array($end);
$count = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_messages` WHERE `theme` = '".$theme['id']."'"), 0);
$all_page = intval(($count - 1) / 10) + 1;
$name = checkout($theme['name']);
$who = checkout($theme['login']);
if($theme['fix'] == 1) { echo '<img src="/ico/stick.gif" alt=""/> ';
} else {
echo '<img src="/ico/topics.gif" alt="image" /> ';
}
if($theme['18'] == 1) {
echo '<a href = "/forum.php?act=theme&id='.$theme['id'].'&cat=1">'.$name.'</a> ('.$count.')</a>';
} else {
echo '<a href = "/forum.php?act=theme&id='.$theme['id'].'">'.$name.'</a> ('.$count.')</a>';
}
if($theme['close'] == 1) { echo ' <img src="/ico/lock.gif" alt="image" />'; }
if($theme['18'] == 1) { echo '<a href = "/forum.php?act=theme&id='.$theme['id'].'&cat=1&page='.$all_page.'"> → </a></br>';
} else {
echo '<a href = "forum.php?act=theme&id='.$theme['id'].'&page='.$all_page.'"> → </a></br>';
}
echo '<small>';
echo ''.$who.' / '.vremya($end_msg['time']).' ';
if($theme['18'] == 1) { echo '/ <font color="red">18+</font>'; }
echo '</small>';
if ($u['admin'] == 1 || $u['admin'] == 2 || $u['admin'] == 3) { echo '<br><small><a href = "forum.php?act=edit_theme&id='.$theme['id'].'">Изменить</a> - <a href = "forum.php?act=delete_theme&id='.$theme['id'].'">Удалить</a></small>'; }
echo '</div>';
$i++;
}
navigation($page, $total,'sforum.php?act=search&');
} else {
echo '<div class="div"><img src="/ico/error.gif" alt="Ошибка" /> По запросу <b>' . $s . '</b> ничего не найдено!</div>';
}
}
}
break;
default:
echo '<div class="title">';
echo '<img src="/ico/forum.png" alt="!"/> <a href = "/forum.php">Форум</a> <b>Поиск</b>';
echo '</div>';
echo '<div class="div">';
echo '<FORM method="POST" action="sforum.php?act=search&ok=1">
Часть текста:<br/>
<input type="text" name="s"/>
<br/>
<input type="submit" name="ok" value="Найти"/>
</FORM>';
echo '</div>';
break;
}
include '../foot.php';
?>