Файл: setk/plugins/notes/search.php
Строк: 72
<?
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
/* Бан пользователя */
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `razdel` = 'notes' AND `id_user` = '$user[id]' AND (`time` > '$time' OR `view` = '0' OR `navsegda` = '1')"), 0)!=0)
{
header('Location: /ban.php?'.SID);exit;
}
$set['title']='Дневники';
include_once '../../sys/inc/thead.php';
title();
echo "<div class='hide'>";
echo "<a href='index.php'>Дневники</a> / Поиск ";
echo "</div>";
$usearch=NULL;
if (isset($_SESSION['usearch']))$usearch=$_SESSION['usearch'];
if (isset($_POST['usearch']))$usearch=$_POST['usearch'];
if ($usearch==NULL)
unset($_SESSION['usearch']);
else
$_SESSION['usearch']=$usearch;
$usearch=preg_replace("#( ){1,}#","",$usearch);
$order='order by `time` desc';
echo "<div class='hide'><form method="post" action="search.php?go">";
$usearch=stripcslashes(htmlspecialchars($usearch));
echo "<input type="text" name="usearch" maxlength="16" value="$usearch" placeholder='Введите пару слов для поиска...' style='width: 70%;' />n";
echo "<input type="submit" value="Искать" />";
echo "</form></div>n";
if (isset($_GET['go']))
{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `notes` where `name` like '%".mysql_escape_string($usearch)."%'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `notes` WHERE `name` like '%".mysql_escape_string($usearch)."%' $order LIMIT $start, $set[p_str]");
echo "<table class='post'>n";
if ($k_post==0)
{
echo "<div class='block'>n";
echo "Нет дневниковn";
echo "</div>n";
}
$num=0;
while ($post = mysql_fetch_assoc($q))
{
echo "<a class='touch_white' href='list.php?id=$post[id]'>";
echo group($avtor['id']) . " $avtor[nick] ";
echo medal($avtor['id']) . " " . online($avtor['id']) . "</br> ";
echo htmlspecialchars($post['name'])."";
echo " <span class='color' style='float: right;'>".vremja($post['time'])."</span></a>n";
echo " </div>n";
}
echo "</table>n";
if ($k_page>1)str('?go&',$k_page,$page); // Вывод страниц
}
include_once '../../sys/inc/tfoot.php';
?>