File size: 4.1Kb
<?
define(H, $_SERVER['DOCUMENT_ROOT'] . '/');
include_once H.'sys/inc/home.php';
include_once H.'sys/inc/start.php';
include_once H.'sys/inc/compress.php';
include_once H.'sys/inc/sess.php';
include_once H.'sys/inc/settings.php';
include_once H.'sys/inc/db_connect.php';
include_once H.'sys/inc/ipua.php';
include_once H.'sys/inc/fnc.php';
include_once H.'sys/inc/user.php';
if (isset($_POST['search']))
{
$_SESSION['search_'] = $_POST['search'];
}
// Если ничего не искали
if (!isset($_SESSION['search_']))
$_SESSION['search_'] = NULL;
else
{
$search_text = text($_SESSION['search_']);
}
// Конфигурационный файл
include 'inc/config.php';
// Заголовок
$set['title'] = $search_name;
include_once H.'sys/inc/thead.php';
err();
title();
aut();
?>
<div class="main">
<img src="/style/icons/str.gif"> <?=(isset($_GET['search']) ? '<a href="?">' . $search_name . '</a>' : $search_name)?>
</div>
<?
if (isset($_GET['search']) && isset($search_text))
{
$count['people'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE
`id` <=> '" . $search_text . "' OR
`nick` like '%" . $search_text . "%' OR
(`ank_icq` <=> '" . $search_text . "' AND `ank_icq` != '0') OR
(`ank_city` = '" . $search_text . "') OR
(`ip` <=> '" . ip2long($search_text) . "' AND `ip` != NULL) OR
`ank_mail` <=> '" . $search_text . "'
"), 0);
$count['obmen'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE
`name` like '%" . $search_text . "%' OR
`name` like '%" . translit($search_text) . "%' OR
`name` like '%" . retranslit($search_text) . "%' OR
`opis` like '%" . $search_text . "%' OR
`opis` like '%" . translit($search_text) . "%' OR
`opis` like '%" . retranslit($search_text) . "%'
"), 0);
$count['notes'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `notes` WHERE
`name` like '%" . $search_text . "%' OR
`name` like '%" . translit($search_text) . "%' OR
`name` like '%" . retranslit($search_text) . "%' OR
`msg` like '%" . $search_text . "%' OR
`msg` like '%" . translit($search_text) . "%' OR
`msg` like '%" . retranslit($search_text) . "%'
"), 0);
$count['forum'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t` WHERE
`name` like '%" . $search_text . "%' OR
`text` like '%" . $search_text . "%'
"), 0);
if ($_GET['search'] == 'people')
include 'inc/people.php';
elseif ($_GET['search'] == 'obmen')
include 'inc/obmen.php';
elseif ($_GET['search'] == 'notes')
include 'inc/notes.php';
elseif ($_GET['search'] == 'forum')
include 'inc/forum.php';
else
{
$i = 0;
if ($count['people'] != 0)
{
echo '<a class="link" href="?search=people"><img src="/style/icons/users.png"> Люди <span class="c">' . $count['people'] . '</span></a>';
++$i;
}
if ($count['obmen'] != 0)
{
echo '<a class="link" href="?search=obmen"><img src="' . $icon_obmen . '" /> Файлы <span class="c">' . $count['obmen'] . '</span></a>';
++$i;
}
if ($count['notes'] != 0)
{
echo '<a class="link" href="?search=notes"><img src="' . $icon_notes . '" /> Дневники <span class="c">' . $count['notes'] . '</span></a>';
++$i;
}
if ($count['forum'] != 0)
{
echo '<a class="link" href="?search=forum"><img src="' . $icon_forum . '" /> Форум <span class="c">' . $count['forum'] . '</span></a>';
++$i;
}
if ($i == 0)
{
?>
<form action="?search" method="post">
<input type="text" name="search" value="<?=text($_SESSION['search_'])?>" placeholder="<?=$placeholder?>"/>
<input type="submit" value="<?=$submit?>"/>
</form>
<?
echo '<div class="mess">';
echo 'По запросу <b>' . $search_text . '</b> ничего не найдено =(';
echo '</div>';
}
}
}
else
{
?>
<form class="mess" action="?search" method="post">
<input type="text" name="search" value="<?=text($_SESSION['search_'])?>" placeholder="<?=$placeholder?>"/>
<input type="submit" value="<?=$submit?>"/>
</form>
<?
}
include_once H.'sys/inc/tfoot.php';
?>