Файл: moduls/users/index.php
Строк: 53
<?php
/**
* @package Prime Social
* @link http://primesocial.ru
* @copyright Copyright (C) 2016 Prime Social
* @author BoB | http://primesocial.ru/about
*/
require_once('../../core/start.php');
check_auth();
head('Foydalanuvchilar');
if (!empty($_GET['sort'])) {
if ($_GET['sort'] == 'man') {
$_SESSION['sort'] = 'man';
} else {
$_SESSION['sort'] = 'woman';
}
}
echo DIV_BLOCK;
echo '<a href="/newusers"><b>Yangi</b> foydalanuvchilar</a></br>';
echo ( empty($_SESSION['sort']) || $_SESSION['sort'] == 'man' ? '<b>[Yigitlar]</b>' : '<a href="?sort=man">[Yigitlar]</a>') . ' ' . ($_SESSION['sort'] == 'woman' ? '<b>[Qizlar]</b>' : '<a href="?sort=woman">[Qizlar]</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('Yigitlar', 'Yigitlar');
} else {
$all = DB::$dbs->querySingle("SELECT COUNT(`user_id`) FROM ".USERS." WHERE `gender` = '0' ORDER BY `user_id` DESC");
$gender = array('Qizlar', 'Qizlar');
}
if (empty($all)) {
echo DIV_BLOCK . $gender[1] . ' yo`q' . 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']) ? 'Yosh: ' . $ank['age'] : 'Yosh ko`rsatilinmagan') . ') <br />' . city($ank['city']) . CLOSE_DIV;
}
echo $n->navi();
}
echo '<div class="white">';
echo '<form action="'.HOME.'/users/search/" enctype="multipart/form-data" method="POST">';
echo '<input type="text" name="q" placeholder="Foydalanuvchilarni izlash" style="width:85%;"/> <input type="submit" name="search" style="width:10%;" value="Izlash" /><br />';
echo ' ID orqali: <input type="checkbox" name="type" value="1" /></form>';
echo CLOSE_DIV;
$array = array();
nav($array);
require_once('../../core/stop.php');
?>