<?
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();

# Форма поиска
$usearch=stripcslashes(htmlspecialchars($usearch));
echo '<div class="block_search">';
echo '<table class="search">';
echo '<form method="post" action="people_search.php?go&amp;sort='.$sort.'&amp;'.$por.'">';
echo '<td><button class="button_search" type="submit"><img src="/img/search.png"></button></td>';
echo '<td><input class="input_search" placeholder="Поиск" type="text" name="usearch" maxlength="30" autocomplete="off"></td>';
echo '</form>';
echo '</table>';
echo '</div>';

$avt = mysql_fetch_assoc(mysql_query("SELECT id, ank_city FROM `user` WHERE `rating` > '0' " . (isset($user) ? "AND `ank_city` = '$user[ank_city]'" : null). " AND ank_city is not NULL AND ank_city != '' ORDER BY `rating` DESC LIMIT 1"));
$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'];

$q = mysql_query("SELECT * FROM `user` ORDER BY `date_last` DESC LIMIT $start, $set[p_str]");

# Вывод людей
while ($ank = mysql_fetch_assoc($q)){
$uSet = mysql_fetch_array(mysql_query("SELECT * FROM `user_set` WHERE `id_user` = '$ank[id]'  LIMIT 1"));
$frend = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE (`user` = '$user[id]' AND `frend` = '$ank[id]') OR (`user` = '$ank[id]' AND `frend` = '$user[id]') LIMIT 1"),0);
$frend_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends_new` WHERE (`user` = '$user[id]' AND `to` = '$ank[id]') OR (`user` = '$ank[id]' AND `to` = '$user[id]') LIMIT 1"),0);

echo '<table class="block3">';
echo '<td class="block_avatar">';
echo ''.avatar($ank['id']).'</a> <span class="avatar_icon">'.online($ank['id']).'</span>';
echo '</td>';
echo '<td class="block_info">';
echo '<span class="nick">'.user::nick($ank['id']).'</span>';
echo '<div class="block_msg">';
echo '<span style="color: #828282; font-size: 14px;">';
if ($ank['ank_name']!=NULL){
echo ''.$ank[ank_name].' ';
}else{
}
if ($ank['ank_fam']!=NULL){
echo ''.$ank[ank_fam].'';
}else{
}
echo '</span>';
echo '</div>';
echo '</td>';
echo '</table>';
	
}

# Навигация
if ($k_page>1)str("?",$k_page,$page);

include_once '../sys/inc/tfoot.php';

?>