Файл: moduls/users/search.php
Строк: 47
<?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('Foydalanuvchilarni izlash');
if (empty($_POST['q'])) {
echo DIV_BLOCK . 'So`rov bo`sh' . CLOSE_DIV;
} else {
if (!empty($_POST['type'])) {
$q = abs(num($_POST['q']));
$ank = DB::$dbs->queryFetch("SELECT * FROM ".USERS." WHERE `user_id` = ?",array($q));
if (!empty($ank)) {
echo DIV_BLOCK . 'Topilgan foydalanuvchilar: <b>' . userLink($ank['user_id']) . '</b>' . CLOSE_DIV;
} else {
echo DIV_BLOCK . 'Foydalanuvchilar topilmadi' . CLOSE_DIV;
}
} else {
echo DIV_LI . 'Izlash natijalari:' . CLOSE_DIV;
$q = html($_POST['q']);
$all = DB::$dbs->querySingle("SELECT COUNT(`user_id`) FROM ".USERS." WHERE `nick` LIKE '%".$q."%' ORDER BY `user_id` DESC");
if ($all > 0) {
$n = new Navigator($all,10,'');
$sql = DB::$dbs->query("SELECT * FROM ".USERS." WHERE `nick` LIKE '%".$q."%' 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();
} else {
echo DIV_BLOCK . 'Natijalar bo`sh' . CLOSE_DIV;
}
}
}
echo '<div class="line">Foydalanuvchilarni izlash</div>';
echo '<div class="grey">';
echo '<form action="'.HOME.'/users/search/" enctype="multipart/form-data" method="POST">';
echo '<input type="text" name="q" value="'.(!empty($_POST['q']) ? html($_POST['q']) : NULL).'" /><br />ID Orqali: <input type="checkbox" name="type" value="1" /><br />';
echo '<input type="submit" name="search" value="Izlash" /></form>';
echo CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/users/">Foydalanuvchilar</a> / <b>Foydalanuvchilarni izlash</b>' . CLOSE_DIV;
require_once('../../core/stop.php');
?>