Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace apathy\HiveSkill\Cron;
- class ReservedSlots
- {
- public static function fetchSlotOwners()
- {
- $app = \XF::app();
- $db = \XF::db();
- $finder = \XF::finder('XF:User');
- $fetch = $app
- ->http()
- ->client()
- ->get('https://api.fortreeforums.xyz/shitbox/Reserved');
- $fetch = \GuzzleHttp\json_decode($fetch->getBody(), true);
- foreach ($fetch['ids'] as $player)
- {
- $server_id = 1;
- $steam_id = $player;
- $uid = $finder->where('ap_steam_id', $steam_id)->fetchOne();
- if(!$uid)
- {
- $user_id = NULL;
- $username = '';
- }
- else
- {
- $user_id = $uid->user_id;
- $username = $uid->username;
- }
- /* Submit it to the DB */
- $stats = $db->query("REPLACE INTO xf_ap_ns2_server_reserved_slots
- (server_id,
- steam_id,
- name,
- user_id)
- VALUES (?, ?, ?, ?)",
- [$server_id, $steam_id, $username, $user_id]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement