<?php
  
$account = DB::GET_STRING("SELECT * FROM `USERS` WHERE `ID` = '".INTVAL(GET('id'))."' LIMIT 1");

IF (!$account['ID']){
  
  ERROR('Такого пользователя не существует', 'session');
  REDIRECT('/modules/?path=games');

}
  
//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/id".$account['ID']."'>".$account['LOGIN']."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".LG('Игры')." ".$account['LOGIN']."";
ECHO "</div>";

ECHO "<div class='list'>";
ECHO "<a href='/modules/?path=games' class='btn-o'>".ICONS('gamepad', 15, 'fa-fw')."".LG('Все игры')."</a>";
ECHO "</div>";

$column = DB::GET_COLUMN("SELECT COUNT(*) FROM `GAMES_USERS` WHERE `USER_ID` = '".$account['ID']."'");
$spage = SPAGE($column, $page_settings);
$page = PAGE($spage);
$limit = $page_settings * $page - $page_settings;

IF ($column == 0){ 
  
  HTML::EMPTY();
  
}ELSE{
  
  ECHO "<div class='list-body'>"; 
  
}

$data = DB::GET_STRING_ALL("SELECT * FROM `GAMES_USERS` WHERE `USER_ID` = '".$account['ID']."' ORDER BY `ID` DESC LIMIT ".$limit.", ".$page_settings."");
WHILE ($list2 = $data->FETCH())
{
  
  $list = DB::GET_STRING("SELECT * FROM `GAMES` WHERE `ID` = '".$list2['GAME_ID']."' LIMIT 1");
  
  REQUIRE (ROOT.'/modules/games/plugins/games_list.php');

}

IF ($column > 0){
  
  ECHO "</div>";
  
}

IF ($spage > 1){ ECHO STR_PAGE('/modules/?path=games&section=users&id='.$account['ID'].'&', $spage, $page); }

//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/id".$account['ID']."'>".$account['LOGIN']."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".LG('Игры')." ".$account['LOGIN']."";
ECHO "</div>";
  
?>