Файл: wenr.online/app/clan/top.php
Строк: 27
<?php
if (!$user->isAuth()) {
redirect('/');
exit;
}
function count_clan($clan){
global $db;
return $db->query('select user_id from users where clan = '.$clan)->rowCount();
}
function count_town($clan){
global $db;
return $db->query('select id from town where user = '.$clan)->rowCount();
}
$sort = 'rating';
if($_GET['type'] == 'bonus') $sort = 'attack+def+lucky';
$all = $db->prepare('select * from clan order by '.$sort.' desc');
$all -> execute();
$all = $all->fetchAll();
$peger = new ArrayPaginator('/clan/top', 5);
$items = $peger->getItems($all);
echo $template->render('clan.top', ['items'=>$items, 'peger'=>$peger]);