Файл: Kulinar/search.php
Строк: 82
<?
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';
only_reg();
$set['title']='Найти блюдо';
include_once '../sys/inc/thead.php';
title();
aut();
echo "<div class='nav2'><img src='/Kulinar/img/logo.png' /></div> ";
$st_search=NULL;
if (isset($_SESSION['st_search']))
{
$st_search=$_SESSION['st_search'];
}
if (isset($_POST['st_search']))
{
$st_search=$_POST['st_search'];
}
if ($st_search==NULL)
{
unset($_SESSION['st_search']);
}else{
$_SESSION['st_search']=$st_search;
}
$st_search=preg_replace("#( ){1,}#","",$st_search);
if (isset ($_GET['go']) && $st_search!=NULL)
{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `Kulinar_files` WHERE `name` like '%".mysql_escape_string($st_search)."%'"), 0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if ($k_post==0)
{
echo "<div class='err'>";
echo "<b>Нет совпадений!</b>";
echo "</div>";
}
$q=mysql_query("SELECT * FROM `Kulinar_files` WHERE `name` like '%".mysql_escape_string($st_search)."%' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while ($post=mysql_fetch_assoc($q))
{
$poste=mysql_fetch_assoc(mysql_query("SELECT * FROM `Kulinar_dir` WHERE `id` = '".$post['id_dir']."'"));
$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '".$post['id_user']."'"));
echo "<table style='width:100%' cellspacing='1' cellpadding='1'><tr>";
echo "<td class='main'>";
echo "<img src='/Kulinar/img/txt.png' /> ";
echo "<a href='/Kulinar".$poste['dir']."".$post['name'].".htm'>".$post['name']."</a><br />";
echo "</td></tr>";
echo "<tr><td class='main2'>";
echo "<img src='/Kulinar/img/time.png' /> ".vremja($post['time'])."<br />";
echo "<img src='/Kulinar/img/avtor.png' /> <a href='/info.php?id=$ank[id]'>".$ank['nick']."</a> ".online($ank['id'])."<br />";
echo "</td>";
echo "</tr></table>";
}
if ($k_page>1)
{
str("/library/search.php?go&$por&",$k_page,$page);
}
}
echo "<form method='post' action='?go'>";
echo "<div class='main'>";
echo "<img src='/Kulinar/img/search.png'> ";
echo "<b>Введите название блюдо:</b><br />";
echo "<input type='text' name='st_search' value='".stripcslashes(htmlspecialchars($st_search))."' /><br />";
echo "<input type='submit' value='Найти' />";
echo "</div>";
echo "</form>";
echo "<a href='/Kulinar/index.php'><div class='foot'>";
echo "<img src='/Kulinar/img/go.png'> В кулинарию";
echo "</div></a>";
include_once '../sys/inc/tfoot.php';
?>