<?
/**
 * Знакомства для DCMS v6.6.4
 * Автор Plato
 * icq 258549
 */

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

echo '<div class="foot">Всего анкет: '. mysql_result(mysql_query("SELECT COUNT(*) FROM `user`"), 0) .' <a href="../users.php"><small>[смотреть]</small></a></div>';

echo '<div class="main_menu">
<img src="img/search.png" alt="" /> <a href="search.php">Поиск друзей</a><br />
<img src="img/female.png" alt="" /> <a href="female.php">Девушек</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `pol` = '0'"), 0) .')<br />
<img src="img/male.png" alt="" /> <a href="male.php">Парней</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `pol` = '1'"), 0) .')
</div>';

echo '<div class="foot">Рейтинг сайта:</div>';

if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user`"), 0) == 0) {
	echo '<div class="main_menu">Пользователей нет</div>';
} else {

	if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `pol` = '0'"), 0) == 0) {
          echo '<div class="main_menu">Девушек нет</div>';
	} else {
		echo '<div class="main_menu">Лучшая девушка:<br />';
		
		$female = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `pol` = '0' ORDER BY `rating` DESC LIMIT 1"));
		
		avatar($female['id']);
		
		echo '<br />Логин: <a href="/info.php?id='. $female['id'] .'">'. $female['nick'] .'</a><br />
		Рейтинг: '. $female['rating'] .'</div>';
	}

	if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `pol` = '1'"), 0) == 0) {
          echo '<div class="main_menu">Парней нет</div>';
	} else {
		echo '<div class="main_menu">Лучший парень:<br />';

		$male = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `pol` = '1' ORDER BY `rating` DESC LIMIT 1"));

		avatar($male['id']);

		echo '<br />Логин: <a href="/info.php?id='. $male['id'] .'">'. $male['nick'] .'</a><br />
		Рейтинг: '. $male['rating'] .'</div>';
	}

}

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