<?
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();
echo '<div class="gmenu">';
echo "<img src='1.png' alt='enk'/> <a href='man.php'>Парни</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `pol` = '1'"),0).")<br />\n";
echo "</div>";
echo '<div class="gmenu">';
echo "<img src='0.png' alt='enk'/> <a href='woman.php'>Девушки</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `pol` = '0'"),0).")<br />\n";
echo "</div>";

################################################################################
echo '<div class="foot">Лучшая девушка:</div>';
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user`"),0) == 0) {
?>
<div class='noy'>Пользователей нет!</div>
<?
}else{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `pol` = '0'"),0) == 0) {
?>
<div class='err'>Лучшей девушки нет!</div>
<?
}else{
echo "<div class='enk_div'>\n";
$female = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `pol` = '0' ORDER BY `rating` DESC LIMIT 1"));
avatar3($female['id']);
echo "<br />\n";
#############
echo "".on($female['id'])."\n";
echo "".pol($female['id'])."";
echo "<a href='/info.php?id=$female[id]'>$female[nick]</a>\n";
echo "".medal($female['id'])."\n";
echo "</div>\n";
}
################################################################################
echo '<div class="foot">Лучший парень:</div>';

if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `pol` = '1'"),0) == 0){
?>
<div class='err'>Лучшего парня нет!</div>
<?
}else{
echo "<div class='enk_div'>\n";
$male = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `pol` = '1' ORDER BY `rating` DESC LIMIT 1"));
avatar3($male['id']);
echo "<br />\n";
#############
echo "".on($male['id'])."\n";
echo "".pol($male['id'])."";
echo "<a href='/info.php?id=$male[id]'>$male[nick]</a>\n";
echo "".medal($male['id'])."\n";
echo "</div>\n";
}
}
$c=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `date_last` > '".(time()-600)."'"), 0);
echo '<div class="fyt"><center>Сейчас на сайте ('.$c.')</center></div>';
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `date_last` > '".(time()-600)."'"), 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 `id` FROM `user` WHERE `date_last` > '".(time()-600)."' ORDER BY `date_last` DESC LIMIT $start, $set[p_str]");
if ($k_post==0)
{
?>
<div class='noy'>Сейчас на сайте никого нет</div>
<?
}
while ($ank = mysql_fetch_assoc($q))
{
$ank=get_user($ank['id']);
if($num==1){
echo "<div class='enk_div'>\n";
$num=0;
}else{
echo "<div class='enk2_div'>\n";
$num=1;}
echo "".avatar2($ank['id'])."<br />";
echo "".on($ank['id'])."\n";
echo "".pol($ank['id'])."";
echo "<a href='/info.php?id=$ank[id]'><span style='color:$ank[ncolor]'>$ank[nick]</span></a>\n";
echo "".medal($ank['id'])."<br />";
if ($ank['pol']==1)
echo "(Муж)";
else
echo "(Жен)";

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[ank_age] лет";
}
if ($ank['ank_city']!=NULL)echo ", $ank[ank_city]";

echo "</div>\n";
}

if ($k_page>1)str("?",$k_page,$page);
echo "<div class='fyt'>\n";
echo "<img src='/style/images/left.gif' alt='' class='icon'/> <a href='/'>Старт</a> &laquo Знакомства\n";
echo "</div>\n";
include_once '../sys/inc/tfoot.php';
?>