Файл: pages/frend.php
Строк: 106
<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
only_reg();
$set['title'] = 'Список друзей';
include_once '../sys/inc/thead.php';
title();
aut();
$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('Заявка отправлена');
if ($ank['id']==$user['id'])
{
echo "<table class='post'><tr><td class='icon14'>
<img src='/style/icons/friendship.gif'>
</td><td class='p_t'>
Список ваших друзей | <a href='frend_new.php'>Заявки</a></td></tr></table>";
}
else echo '<div class="p_t">Список друзей '.$ank['nick'].'</div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
echo "<table class='post'>n";
if ($k_post==0)
{
echo " <tr>n";
echo " <td class='p_t'>n";
echo "Нет друзей =(n";
echo " </td>n";
echo " </tr>n";
}
$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 time DESC LIMIT $start, $set[p_str]");
while ($f = mysql_fetch_array($q))
{
$a = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[frend]' LIMIT 1"));
if ($set['set_show_icon']==2){
echo " <td class='icon48' rowspan='2'>n";
avatar($a['id']);
echo " </td>n";
}
elseif ($set['set_show_icon']==1)
{
echo " <td class='icon14'>n";
echo "".status($a['id'])."";
echo " </td>n";
}
echo ' <td class="p_t">';
echo '<a href="/info.php?id='.$a['id'].'">'.$a['nick'].'</a>'.online($a['id'])."n";
echo ' </td>';
echo ' </tr>';
echo ' <tr>';
if ($set['set_show_icon']==1)echo ' <td class="p_m" colspan="2">'; else echo ' <td class="p_m">';
echo ' <span class="ank_n">Подружились</span> <span class="ank_d">'.vremja($f['time']).'</span><br />';
echo '<span class="ank_n">Посл. посещение:</span> <span class="ank_d">'.vremja($a['date_last']).'</span><br />'."n";
if ($ank['id']==$user['id'])echo '<a href="frend_new.php?no='.$a['id'].'">Удалить</a>';
echo ' </td>'."n";
echo ' </tr>'."n";
}
echo '</table>'."n";
if ($k_page>1)str("?id=$ank[id]&",$k_page,$page); // Вывод страниц
include_once '../sys/inc/tfoot.php';
?>