<?php

require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';
$title = 'Люди';
require_once '../incfiles/head.php';

$act = htmlentities(trim($_GET['act']));

echo '<div class="title">
	<a '. ($act == false?'class="title_a_hover"':'') .' href="'.URL.'/people/pk_people.php" onclick="Page.Go(this.href); return false">Люди</a>
	<a '. ($act == 'online'?'class="title_a_hover"':'') .' href="'.URL.'/people/pk_people.php?act=online" onclick="Page.Go(this.href); return false">Онлайн</a>
	<a '. ($act == 'search'?'class="title_a_hover"':'') .' href="'.URL.'/people/pk_people.php?act=search" onclick="Page.Go(this.href); return false">'.lang('Поиск','Пошук').'</a>
	';
?><a class=" "  onclick="javascript:Menu('1')"><? echo'<img src="'.URL.'/design/img/filter.jpg" width="15" height="15" alt="filter news"/> '.lang('Фильтр','Фільтр').''; ?></li/></div>


	
<html>
<head>
<script type="text/javascript">
function Menu(id)
{
var menu = document.getElementById('menu_' + id).style;
if (menu.display == 'none')
{
menu.display = 'block';
}
else
{
menu.display = 'none';
}
}
</script>
</head>
</body> 
</html>


</a>
<ul id="menu_1" style="display:none;" >
<div class="content_block">
<?echo'
<a href="'.URL.'/people/pk_people.php?act=dw" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/users.png"/>'.lang('Только Женщины','Тільки Жінки').'</li></a>
<a href="'.URL.'/people/pk_people.php?act=dm" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/users.png"/>'.lang('Только Мужчины','Тільки Чоловіки').'</li></a>
<a href="'.URL.'/people/pk_people.php?act=dmonline" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/users.png"/>'.lang('Мужчины Онлайн','Чоловіки Онлайн').'</li></a>
<a href="'.URL.'/people/pk_people.php?act=dwonline" onclick="Page.Go(this.href); return false"><li><img src="'.URL.'/design/img/menu/users.png"/>'.lang('Женщины Онлайн','Жінки Онлайн').'</li></a>

';
?>

</div>

</ul></div>
	
	<?php
switch($act)
{
default:

echo '<div class="title">'.lang('VIP пользователи','VIP користувачі').'</div>';
//Вивід нового користувача)))
$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `access_best` = 0"),0);
if ($all > 0)
{
	$cp = ceil($all/10);
	$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
	$start = $p*10-10;
	$res = mysql_query("SELECT * FROM `users` WHERE `access_best` = 0 ORDER BY  RAND() DESC LIMIT $start,1");
	while ($array = mysql_fetch_array($res)) echo '<div class="block"><img src="'.URL.'/design/img/vip.png"/> '.user_namepeople($array['id'],1,1).'</div>';
}


echo '<div class="title">'.lang('Люди','Люди').'</div>';
$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `ban` = 0"),0);
if ($all > 0)
{
	$cp = ceil($all/10);
	$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
	$start = $p*10-10;
	$res = mysql_query("SELECT * FROM `users` WHERE `ban` = 0 ORDER by `regtime` DESC LIMIT $start,10");
while ($array = mysql_fetch_array($res)) echo '<div class="block">'.user_namepeople($array['id'],1,1).'</div>';
while ($array = mysql_fetch_array($res))echo '<a class="button" href="'.URL.'/mail/new.php?id='.$arr_user['id'].'" onclick="Page.Go(this.href); return false">'.lang('Написать сообщение','Написати повідомлення').'</a>';

	navi($p,$cp,'/people/pk_people.php?');
}
break;
//люди стать чол
case 'dm':
echo '<div class="title">'.lang('Люди - фльтр пол Мужчины','Люди - фільтр стать Чоловіки').'</div>';
$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `ban` = 0"),0);
if ($all > 0)
{
	$cp = ceil($all/10);
	$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
	$start = $p*10-10;
	$res = mysql_query("SELECT * FROM `users` WHERE `sex` = 1 ORDER by `regtime` DESC LIMIT $start,10");
while ($array = mysql_fetch_array($res)) echo '<div class="block">'.user_namepeople($array['id'],1,1).'</div>';
while ($array = mysql_fetch_array($res))echo '<a class="button" href="'.URL.'/mail/new.php?id='.$arr_user['id'].'" onclick="Page.Go(this.href); return false">'.lang('Написать сообщение','Написати повідомлення').'</a>';

	navi($p,$cp,'/people/pk_people.php?act=dm&');
}



break;

//люди стать жінки
case 'dw':
echo '<div class="title">'.lang('Люди - фльтр пол Женский','Люди - фільтр стать Жінки').'</div>';
$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `ban` = 0"),0);
if ($all > 0)
{
	$cp = ceil($all/10);
	$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
	$start = $p*10-10;
	$res = mysql_query("SELECT * FROM `users` WHERE `sex` = 2 ORDER by `regtime` DESC LIMIT $start,10");
while ($array = mysql_fetch_array($res)) echo '<div class="block">'.user_namepeople($array['id'],1,1).'</div>';
while ($array = mysql_fetch_array($res))echo '<a class="button" href="'.URL.'/mail/new.php?id='.$arr_user['id'].'" onclick="Page.Go(this.href); return false">'.lang('Написать сообщение','Написати повідомлення').'</a>';

	navi($p,$cp,'/people/pk_people.php?act=dw&');
}
break;
case 'online':


echo '<div class="title">'.lang('VIP пользователи','VIP користувачі').'</div>';
//Вивід нового користувача)))
$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `access_best` = 0"),0);
if ($all > 0)
{
	$cp = ceil($all/10);
	$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
	$start = $p*10-10;
	$res = mysql_query("SELECT * FROM `users` WHERE `access_best` = 0 ORDER BY  RAND() DESC LIMIT $start,1");
	while ($array = mysql_fetch_array($res)) echo '<div class="block"><img src="'.URL.'/design/img/vip.png"/> '.user_namepeople($array['id'],1,1).'</div>';
}





echo '<div class="title">'.lang('Люди онлайн','Люди онлайн').'</div>';

$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `online` = 1"),0);
if ($all > 0)
{
	$cp = ceil($all/10);
	$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
	$start = $p*10-10;
	$res = mysql_query("SELECT * FROM `users` WHERE `online` = 1 ORDER by `visit` DESC LIMIT $start,10");
	
	while ($array = mysql_fetch_array($res)) echo '<div class="block">'.user_namepeople($array['id'],1,1).'  </div>';
	
	
	navi($p,$cp,'/people/pk_people.php?act=online&');
}
break;

case 'dmonline':
echo '<div class="title">'.lang('Люди онлайн Мужчины','Люди онлайн Чоловіки').'</div>';

$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `online` = 1 AND `sex` = 1"),0);
if ($all > 0)
{
	$cp = ceil($all/10);
	$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
	$start = $p*10-10;
	$res = mysql_query("SELECT * FROM `users` WHERE `online` = 1 AND `sex` = 1 ORDER by `visit` DESC LIMIT $start,10");
	while ($array = mysql_fetch_array($res)) echo '<div class="block">'.user_namepeople($array['id'],1,1).'</div>';
	navi($p,$cp,'/people/pk_people.php?act=dmonline&');
}
break;


case 'dwonline':
echo '<div class="title">'.lang('Люди онлайн Женщины','Люди онлайн Жінки').'</div>';

$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `online` = 1 AND `sex` = 2"),0);
if ($all > 0)
{
	$cp = ceil($all/10);
	$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
	$start = $p*10-10;
	$res = mysql_query("SELECT * FROM `users` WHERE `online` = 1 AND `sex` = 2 ORDER by `visit` DESC LIMIT $start,10");
	while ($array = mysql_fetch_array($res)) echo '<div class="block">'.user_namepeople($array['id'],1,1).'</div>';
	navi($p,$cp,'/people/pk_people.php?act=dwonline&');
}
break;



case 'search':

if (!empty($_GET['r']) && is_numeric($_GET['r']) && mysql_result(mysql_query("SELECT COUNT(`id`) FROM `region` WHERE `id` = '".abs(intval($_GET['r']))."' LIMIT 1"),0) == true) $arr = mysql_fetch_array(mysql_query("SELECT * FROM `region` WHERE `id` = '".abs(intval($_GET['r']))."' LIMIT 1"));

if (!empty($arr))
{
	$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `region` = '".$arr['id']."' AND `ban` = 0"),0);
	
	echo '<div class="title"><div class="right">'.$all.'</div>'.lang($arr['ru_name'],$arr['ua_name']).' обл.</div>';

	if ($all > 0)
	{
		$cp = ceil($all/10);
		$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
		$start = $p*10-10;

		$res = mysql_query("SELECT * FROM `users` WHERE `region` = '".$arr['id']."' AND `ban` = 0 ORDER by `visit` DESC LIMIT $start,10");
		while ($array = mysql_fetch_array($res)) echo '<div class="block">'.user_namepeople($array['id'],1,2).'</div>';
		navi($p,$cp,'/people/pk_people.php?act=search&r='.$arr['id'].'&');
	}
}
else
{
	$res = mysql_query("SELECT * FROM `region` ORDER by `id`");
	while ($array = mysql_fetch_array($res))
	{
		$all_r = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `region` = '".$array['id']."' AND `ban` = 0"),0);
		echo '<div class="block"><a href="'.URL.'/people/pk_people.php?act=search&r='.$array['id'].'" onclick="Page.Go(this.href); return false"><b>'.lang($array['ru_name'],$array['ua_name']).' обл.</b></a> '.($all_r>0?'('.people($all_r).')':'').'</div>';
	}
}
break;
}


require_once '../incfiles/foot.php';

?>