Файл: public_html/user/frends/online.php
Строк: 152
<?
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';
if (isset($_GET['id']))$sid = intval($_GET['id']);
else $sid = $user['id'];
$ank = get_user($sid);
$uSet = mysql_fetch_array(mysql_query("SELECT * FROM `user_set` WHERE `id_user` = '$ank[id]' LIMIT 1"));
$frend = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE (`user` = '$user[id]' AND `frend` = '$ank[id]') OR (`user` = '$ank[id]' AND `frend` = '$user[id]') LIMIT 1"),0);
$frend_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends_new` WHERE (`user` = '$user[id]' AND `to` = '$ank[id]') OR (`user` = '$ank[id]' AND `to` = '$user[id]') LIMIT 1"),0);
if ($ank['id'] != $user['id'] && $user['group_access'] == 0)
{
if (($uSet['privat_str'] == 2 && $frend != 2) || $uSet['privat_str'] == 0) {
if ($ank['group_access'] > 1) {
echo "<div class='err'>$ank[group_name]</div>n";
}
echo "<div class='nav1'>";
echo user::nick($ank['id']);
echo "</div>";
echo "<div class='nav2'>";
echo user::avatar($ank['id']);
echo "</div>";
}
// Если только для друзей
if ($uSet['privat_str'] == 2 && $frend != 2) {
echo '<div class="mess">';
echo 'Просматривать друзей пользователя могут только его друзья!';
echo '</div>';
// В друзья
if (isset($user)) {
echo '<div class="nav1">';
if ($frend_new == 0 && $frend == 0){
echo "<img src='/style/icons/druzya.png' alt='*'/> <a href='/user/frends/create.php?add=".$ank['id']."'>Добавить в друзья</a><br />n";
}elseif ($frend_new == 1){
echo "<img src='/style/icons/druzya.png' alt='*'/> <a href='/user/frends/create.php?otm=$ank[id]'>Отклонить заявку</a><br />n";
}elseif ($frend == 2){
echo "<img src='/style/icons/druzya.png' alt='*'/> <a href='/user/frends/create.php?del=$ank[id]'>Удалить из друзей</a><br />n";
}
echo "</div>";
}
include_once '../sys/inc/tfoot.php';
exit;
}
// Если закрыта
if ($uSet['privat_str'] == 0)
{
echo '<div class="mess">';
echo 'Пользователь запретил просматривать его друзей!';
echo '</div>';
include_once '../sys/inc/tfoot.php';
exit;
}
}
$set['title']="Друзья онлайн $ank[nick]";
include_once '../../sys/inc/thead.php';
title();
aut();
echo "<div id='comments' class='menus'>";
echo "<div class='webmenu'>";
echo "<a href='index.php?id=$ank[id]'>Все (".mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0).")</a>";
echo "</div>";
echo "<div class='webmenu last'>";
echo "<a href='online.php?id=$ank[id]' class='activ'>Онлайн (".mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` INNER JOIN `user` ON `frends`.`frend`=`user`.`id` WHERE `frends`.`user` = '$ank[id]' AND `frends`.`i` = '1' AND `user`.`date_last`>'".(time()-600)."'"), 0).")</a>";
echo "</div>";
if ($ank['id'] == $user['id'])
{
echo "<div class='webmenu last'>";
echo "<a href='new.php'>Заявки (".mysql_result(mysql_query("SELECT COUNT(id) FROM `frends_new` WHERE `to` = '$ank[id]' LIMIT 1"), 0).")</a>";
echo "</div>";
}
echo "</div>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` INNER JOIN `user` ON `frends`.`frend`=`user`.`id` WHERE `frends`.`user` = '$ank[id]' AND `frends`.`i` = '1' AND `user`.`date_last`>'".(time()-600)."'"), 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 `frends` INNER JOIN `user` ON `frends`.`frend`=`user`.`id` WHERE `frends`.`user` = '$ank[id]' AND `frends`.`i` = '1' AND `user`.`date_last`>'".(time()-600)."' ORDER BY `user`.`date_last` DESC LIMIT $start, $set[p_str]");
echo "<table class='post'>n";
if ($k_post == 0)
{
echo '<div class="mess">';
echo 'У вас нет друзей';
echo '</div>';
}
while ($frend = mysql_fetch_assoc($q))
{
$frend = get_user($frend['frend']);
echo '<div class="' . ($num % 2 ? "nav1" : "nav2") . '">';
$num++;
echo user::avatar($frend['id']) . user::nick($frend['id'], 1, 1, 1) . '<br />';
if (isset($user)) {
echo "<a href="/mail.php?id=$frend[id]"><img src='/style/icons/pochta.gif' alt='*' /> Сообщение</a>n";
if ($ank['id'] == $user['id']) {
echo "<div style='text-align:right;'><a href='create.php?del=$frend[id]'><img src='/style/icons/delete.gif' alt='*' /></a></div>";
}
}
echo "</div>n";
}
echo "</table>n";
if ($k_page > 1) {
str('?id=' . $ank['id'] . '&', $k_page, $page);
}
include_once '../../sys/inc/tfoot.php';
?>