<?php
$t = "Друзья";
include_once 'core/core.php';
include_once 'core/twig.php';
include_once 'core/head.php';
exit();

$k_post = $db->Count("users","WHERE `sid` = '".$site->id."'".$where);
$fr = [];
$max = 10;
$k_page = $core->k_page($k_post,$max);
$page = $core->page($k_page);
$start = $max*$page-$max;

$news = $db->Query("SELECT `u.id`, `u.login`, `u.access`, `u.lastVisit`, `u.vip` FROM `users` u JOIN `friends` f ON `u.id` = `f.fid` WHERE `sid` = '".$site->id."' AND `f.uid` = '".$uid."' AND `f.status` = 'accepted' ORDER BY `login` ASC LIMIT $start, $max"); 

while ($ns = mysqli_fetch_assoc($news)){
	$fr[] = [
		"uid"		=>	$ns["id"],
		"login"		=>	$ns["login"],
		"access"	=>	$ns["access"],
		"online"	=>	($ns["lastVisit"]>time()-300?true:false),
		"lastVisit"	=>	($ns["lastVisit"]),
		"vip"		=>	($ns["vip"] > time()-300?true:false),
		
	];
}
if($k_page>1) echo $core->str('?',$k_page,$page);

twig('friends.html',$fr);
include_once 'core/foot.php';