Файл: world-faces.ru/world-faces.ru/obmen/search.php
Строк: 57
<?
include_once '../i.php';
$set['title']='Архив Файлов - поиск';
verh();
aut();
$search=NULL;
if (isset($_SESSION['search']))$search=$_SESSION['search'];
if (isset($_POST['search']))$search=$_POST['search'];
if ($search==NULL)
unset($_SESSION['search']);
else
$_SESSION['search']=$search;
$search=ereg_replace("( ){2,}"," ",$search);
$search=ereg_replace("^( ){1,}|( ){1,}$","",$search);
if (isset($_GET['go']) && $search!=NULL)
{
$search_a=explode(' ', $search);
for($i=0;$i<count($search_a);$i++)
{
$search_a[$i]='#'.preg_quote(esc(trim(stripcslashes(htmlspecialchars($search_a[$i]))))).'#uim';
}
$adm_add=NULL;
if (!isset($user) || $user['level']==0){
$q222=mysql_query("SELECT * FROM `obmennik_files`");
while ($adm_f = mysql_fetch_array($q222))
{
$adm_add.="`id_dir` <> '$adm_f[id]' AND ";
}
}
$q_search=str_replace('%','',$search);
$q_search=str_replace(' ','%',$q_search);
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE $adm_add `nazv` like '%".mysql_escape_string($q_search)."%'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo "<table class='post'>n";
if ($k_post==0)
{
echo "<div class='prof'>По вашему запросу ничего не найдено</div>n";
}
$q=mysql_query("SELECT * FROM `obmennik_files` WHERE `nazv` like '%".mysql_escape_string($q_search)."%' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_array($q))
{
$them=mysql_fetch_array(mysql_query("SELECT * FROM `obmennik_files` WHERE `id` = '$post[id]' LIMIT 1"));
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
echo " <tr>n";
$file=H."sys/obmen/files/$post[id].dat";
$name=$post['name'];
$size=$post['size'];
$dir = mysql_fetch_array(mysql_query("SELECT * FROM `obmennik_dir` WHERE `id` = '$post[id_dir]' LIMIT 1"));
if ($set['echo_rassh']==1)$ras=".$post[ras]";else $ras=NULL;
echo "<div class='prof'><div class='onmenu'>";
$ras = $them['ras'];
if ($set['set_show_icon']==2){
include 'inc/icon48.php';
}
elseif ($set['set_show_icon']==1)
{
include 'inc/icon14.php';
}
echo "<a href='/obmen$dir[dir]$post[name].$post[ras]?showinfo'>$post[nazv] ($ras)</a> (".vremja($post['time']).")</div>n";
}
if ($k_page>1)str("search.php?go&",$k_page,$page);
}
else
echo "Введите текст, который Вы хотите найти<br />n";
echo "<form method="post" action="search.php?go">n";
$search=stripcslashes(htmlspecialchars(esc($search)));
echo "<input type="text" name="search" maxlength="64" value="$search" />n";
echo "<input type="submit" value="Поиск" />n";
echo "</form>n";
echo "<div class="menu">n";
echo "«<a href="index.php" title="В архив">В архив файлов</a>n";
echo "</div>n";
niz();
?>