Файл: user/friends/include.php
Строк: 21
<?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);
if (isset($_GET['add'])) {
msg('Заявка на дружбу успешно отправлена!');
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
if ($k_post == 0) {
echo "<img src = '/style/icons/bullet_error.png' /> У пользователя $ank[nick] нет друзей";
}
$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");
while ($f = mysql_fetch_array($q)) {
$a = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[friends]' LIMIT 1"));
echo "<a href = '/info.php?id=$a[id]' title = '$a[nick]'> ";
avatar($a['id'], '36');
echo "</a>";
}