Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('IN_SB')) die();
- $DB = \DatabaseManager::GetConnection();
- $DB->Prepare('SELECT * FROM `{{prefix}}servers`');
- $Servers = $DB->Finish()->All();
- $groups = [
- // Переназначения имена групп.
- // Например, Вы можете выводить "Обычный VIP-игрок", если в кач-ве группы у игрока прописано "vip"
- 'vip' => 'Обычный VIP-игрок',
- ];
- $DBs = \DatabaseManager::GetConnection('VIP_Core');
- $DBs->Prepare('SELECT * FROM `vip_users` WHERE `expires` = 0 OR `expires` > :current_timestamp ORDER BY `expires` ASC, `group` ASC');
- $DBs->BindData('current_timestamp', time());
- $VIPs = $DBs->Finish()->All();
- foreach ($VIPs as &$VIP) {
- if (isset($servers[$VIP['sid']]))
- $VIP['server_name'] = $servers[$VIP['sid']];
- else
- $VIP['server_name'] = "Неизвестный сервер (#{$VIP['sid']})";
- if (isset($groups[$VIP['group']]))
- $VIP['group'] = $groups[$VIP['group']];
- if($VIP['expires'] == 0)
- $VIP['expired_text'] = 'Никогда';
- elseif($VIP['expires'] < time())
- $VIP['expired_text'] = 'Истёк';
- else
- $VIP['expired_text'] = 'Через '.round((($VIP['expires'] - time()) / 86400),0).' дн.';
- $sid = \CSteamId::factory("[U:1:{$VIP['account_id']}]");
- $VIP['steamid'] = $sid->v2;
- $VIP['communityid'] = $sid->CommunityID;
- }
- global $theme;
- $theme->assign('servers', $Servers);
- $theme->assign('vips', $VIPs);
- $theme->display('page_vips.tpl');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement