<?php

$ank['id'] = $user['id'];
if (isset($_GET['id'])) {
    $ank['id'] = intval($_GET['id']);
}
$q = mysql_query("SELECT * FROM `user` WHERE `id` = $ank[id] LIMIT 1");
if (mysql_num_rows($q) == 0) {
    header("Location: index.php?" . SID);
    exit;
}

$ank = mysql_fetch_array($q);
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);

if ($k_post == 0) {
    
}

$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];

$q = mysql_query("SELECT * FROM `friends` WHERE `user` = '$ank[id]' AND `i` = '1' ORDER BY rand() DESC LIMIT 10");

if ($k_post == 0) {
    
} else {
    echo "<div class='list-group-item-null' style='margin-top: 2px;margin-left: 2px;margin-right: 2px;'><table class=''><tr>";
}
while ($f = mysql_fetch_array($q)) {
    $a = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[friends]' LIMIT 1"));
    echo "<td>";
    if (IS_WEB) {
        echo "<div class='photos'>";
        echo "<span class='photos_blok'><center>$a[nick]</center></span>";
        echo " <a href='/id$a[id]'>";
        avatar($a['id'], '100', 'border-radius: 2px;');
        echo "</a>";
        echo "</div>";
    } else {
        echo "<div class='photos1'>";
        echo "<span class='photos_blok1'><center>$a[nick]</center></span>";
        echo " <a href='/id$a[id]'>";
        avatar($a['id'], '50', 'border-radius: 2px;');
        echo "</a>";
        echo "</div>";
    }
    echo "</td>";
}
if ($k_post == 0) {
    
} else {
    echo "</tr></table></div>";
}