Файл: soc-set/moduls/users/index.php
Строк: 45
<?php
require_once('../../core/start.php');
check_auth();
head('Пользователи сайта');
panel();
echo DIV_BLOCK . 'Пользователи сайта' . CLOSE_DIV;
if (!empty($_GET['sort'])) {
if ($_GET['sort'] == 'man') {
$_SESSION['sort'] = 'man';
} else {
$_SESSION['sort'] = 'woman';
}
}
echo DIV_BLOCK;
echo ( empty($_SESSION['sort']) || $_SESSION['sort'] == 'man' ? '<b>[парни]</b>' : '<a href="?sort=man">[парни]</a>') . ' ' . ($_SESSION['sort'] == 'woman' ? '<b>[девушки]</b>' : '<a href="?sort=woman">[девушки]</a>');
echo CLOSE_DIV;
if (empty($_SESSION['sort']) || $_SESSION['sort'] == 'man') {
$all = DB::$dbs->querySingle("SELECT COUNT(`user_id`) FROM ".USERS." WHERE `gender` = '1' ORDER BY `user_id` DESC");
$gender = array('парни', 'парней');
} else {
$all = DB::$dbs->querySingle("SELECT COUNT(`user_id`) FROM ".USERS." WHERE `gender` = '0' ORDER BY `user_id` DESC");
$gender = array('девушки', 'девушек');
}
if (empty($all)) {
echo DIV_BLOCK . $gender[1] . ' нету' . CLOSE_DIV;
} else {
$n = new Navigator($all,10,'');
if (empty($_SESSION['sort']) || $_SESSION['sort'] == 'man') {
$sql = DB::$dbs->query("SELECT * FROM ".USERS." WHERE `gender` = '1' ORDER BY `user_id` DESC LIMIT {$n->start()}, 10");
} else {
$sql = DB::$dbs->query("SELECT * FROM ".USERS." WHERE `gender` = '0' ORDER BY `user_id` DESC LIMIT {$n->start()}, 10");
}
while($ank = $sql -> fetch()) {
echo DIV_BLOCK . '<b>' . userLink($ank['user_id']) . '</b><br />' . $ank['name'] . ', (' . (!empty($ank['age']) ? 'Возраст: ' . $ank['age'] : 'возраст не указан') . ') <br />' . city($ank['city']) . CLOSE_DIV;
}
echo $n->navi();
}
echo DIV_AUT;
echo '<form action="'.HOME.'/users/search/" enctype="multipart/form-data" method="POST">';
echo '<b>Поиск:</b> <input type="text" name="q" /><br />По ID: <input type="checkbox" name="type" value="1" /><br />';
echo '<input type="submit" name="search" value="Найти" /></form>';
echo CLOSE_DIV;
$array = array();
nav($array);
require_once('../../core/stop.php');
?>