Файл: people_search.php
Строк: 133
<?
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';
$set['title']='Поиск людей'; // заголовок страницы
include_once 'sys/inc/thead.php';
title();
aut();
echo '<table style="text-align:center;" class="mess" cellspacing="0" cellpadding="0">';
echo '<td><a style="border-right:none;" class="panel" href="/people.php">Люди</a></td>';
echo '<td><a style="border-right:none;" class="panel" href="/people_online.php">В сети</a></td>';
echo '<td><a style="border-right:none;" class="panel" href="/people_day.php">За сутки</a></td>';
echo '<td class="panel">Поиск</td>';
echo '</table>';
$sort='id';
$por='DESC';
if (isset($_GET['ASC']))$por='ASC'; // прямой порядок
if (isset($_GET['DESC']))$por='DESC'; // обратный порядок
switch (@$_GET['sort']) {
case 'balls':$sql_sort='`user`.`balls`';$sort='balls'; // баллы
break;
case 'level':$sql_sort='`user_group`.`level`';$sort='level'; // уровень
break;
case 'rating':$sql_sort='`user`.`rating`';$sort='rating'; // рейтинг
break;
case 'pol':$sql_sort='`user`.`pol`';$sort='pol'; // пол
break;
default:$sql_sort='`user`.`id`';$sort='id'; // ID
break;
}
if (!isset($_GET['go']))
{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user`"),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="gmenu">'; echo 'Нет результатов'; echo '</div>';
}
$q=mysql_query("SELECT `user`.`id` FROM `user` LEFT JOIN `user_group` ON `user`.`group_access` = `user_group`.`id` ORDER BY $sql_sort $por LIMIT $start, $set[p_str]");
while ($ank = mysql_fetch_assoc($q))
{
$ank=get_user($ank['id']);
}
echo "</table>n";
if ($k_page>1)str("people.php?sort=$sort&$por&",$k_page,$page); // Вывод страниц
}
$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);
if (isset ($_GET['go']) && $usearch!=NULL)
{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `nick` like '%".mysql_real_escape_string($usearch)."%' OR `id` = '".intval($usearch)."'"),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'>";
if ($k_post==0){
echo '<div class="gmenu">Ничего не найдено</div>';
}
$q=mysql_query("SELECT `id` FROM `user` WHERE `nick` like '%".mysql_real_escape_string($usearch)."%' OR `id` = '".intval($usearch)."' ORDER BY `$sort` $por LIMIT $start, $set[p_str]");
while ($ank = mysql_fetch_assoc($q))
{
$ank=get_user($ank['id']);
echo '<table class="mess">';
echo "<td width='3%'>".avatar($ank['id'])."</td><td> ".group($ank['id'])."";
echo "<a href='/info.php?id=$ank[id]'>$ank[nick]</a>n";
echo "".medal($ank['id'])." ".online($ank['id'])."</br>";
$ank['ank_age'] = null;
if ($ank['ank_d_r'] != NULL && $ank['ank_m_r'] != NULL && $ank['ank_g_r'] != NULL)
{
$ank['ank_age'] = date("Y")-$ank['ank_g_r'];
if (date("n") < $ank['ank_m_r'])
$ank['ank_age'] = $ank['ank_age'] - 1;
elseif (date("n") == $ank['ank_m_r']&& date("j") < $ank['ank_d_r'])
$ank['ank_age'] = $ank['ank_age'] - 1;
}
echo ''.(($ank['pol'] == 1) ? 'М' : 'Ж') . (($ank['ank_age'] == null) ? '/Не указан' : '/' . $ank['ank_age']) . '';
if ($ank['ank_city'] != NULL)
echo ', Г. ' . text($ank['ank_city']);
echo '</td></table>';
}
echo "</table>n";
if ($k_page>1)str("people.php?go&sort=$sort&$por&",$k_page,$page); // Вывод страниц
}
else
echo "<form method="post" action="?go&sort=$sort&$por">";
// ShaMan
$usearch=stripcslashes(htmlspecialchars($usearch));
// Тут конец моих дум
echo '<div class="mess">';
echo "<input placeholder='Введите ник или id' type="text" name="usearch" maxlength="16" value="" /><br />n";
echo "<input type="submit" value="Найти людей" />";
echo "</form>n";
echo '</div>';
include_once 'sys/inc/tfoot.php';
?>