Файл: test.masteram.us/incfrend.php
Строк: 21
<?
$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 `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
if ($k_post==0)
{
echo 'У обитателя '.$ank['nick'].' нет друзей';
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo "<table class='post'>n";
$q = mysql_query("SELECT * FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1' ORDER BY rand() DESC LIMIT 5");
while ($f = mysql_fetch_array($q))
{
$a = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[frend]' LIMIT 1"));
echo '<a href="/info.php?id='.$a['id'].'">';
avatar5($a['id']);
echo '</a>';
}
echo "</table>";
?>