Файл: _downfile_CodWM_21480/foto/search.php
Строк: 81
<?
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` = 'foto' 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();
aut(); // форма авторизации
$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 "<form method="post" action="search.php?go">Введите часть текста или название фото<br />";
$usearch=stripcslashes(htmlspecialchars($usearch));
echo "<input type="text" name="usearch" maxlength="16" value="$usearch" /><br />n";
echo "<input type="submit" value="Искать" />";
echo "</form>n";
if (isset($_GET['go']))
{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` where `name` like '%".mysql_real_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 `gallery_foto` WHERE `name` like '%".mysql_real_escape_string($usearch)."%' $order LIMIT $start, $set[p_str]");
echo "<table class='post'>n";
if ($k_post==0)
{
echo "<div class='mess'>n";
echo "Фотографии не найденыn";
echo "</div>n";
}
if ($k_post>0)
{
echo "<div class='mess'>n";
echo "Найдено результатов: $k_post n";
echo "</div>n";
}
$num=0;
while ($post = mysql_fetch_assoc($q))
{
/*-----------зебра-----------*/
if ($num==0){
echo '<div class="nav1">';
$num=1;
}
elseif ($num==1){
echo '<div class="nav2">';
$num=0;
}
/*---------------------------*/
echo "<img src='/style/icons/foto.png' alt='*'> ";
echo '' . text($post['name']);
echo " <span style='time'>(".vremja($post['time']).")</span>n";
$f=$post['id'];
$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = '" . $f . "' LIMIT 1"));
$gallery = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery` WHERE `id`='" . $foto['id_gallery'] . "' LIMIT 1"));
$ank_p=get_user($gallery['id_user']);
echo '<a href="/foto/' . $ank_p['id'] . '/' . $gallery['id'] . '/' . $post['id'] . '/" title="Перейти к фото">';
// echo "<a href='/foto/foto0/$post[id].$post[ras]' title='Скачать оригинал'>";
echo '<br /><img src="/foto/foto128/' . $post['id'] . '.' . $post['ras'] . '" alt="Photo Screen" /></a><br />';
echo 'Рейтинг: ' . $post['rating'] . '';
//echo 'Комментариев (' . mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_komm` WHERE `id_foto` = '$post[id]'"),0) . ')';
echo " </div>n";
}
echo "</table>n";
if ($k_page>1)str('?go&',$k_page,$page); // Вывод страниц
}
echo "<div class='foot'>";
echo "<img src='/style/icons/str2.gif' alt='*'> ";
echo "<a href='/foto/' >Альбомы</a>";
echo "</div>";
include_once '../sys/inc/tfoot.php';
?>