Файл: friends/online.php
Строк: 83
<?php
require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';
if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
$id = abs(intval($_GET['id']));
$result = mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1");
if (mysql_num_rows($result) == true) $arr_user = mysql_fetch_array($result);
else go(URL);
}
else go(URL.'/');
$title = $arr_user['name'].' '.$arr_user['surname'].' :: '.lang('Мои Друзья','Мої Друзі');
require_once '../incfiles/head.php';
echo user_access_page($arr_user);
$all_on = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `friends` WHERE `user_id` = '".$id."' AND `online` > '".(time() - 600)."' LIMIT 1"),0);
echo '<div class="title">
<a href="'.URL.'/?id='.$id.'" onclick="Page.Go(this.href); return false">'.$arr_user['name'].' '.$arr_user['surname'].'</a>
<a href="'.URL.'/friends/?id='.$id.'" onclick="Page.Go(this.href); return false">'.lang('Друзья','Друзі').' '.$arr_user['count_friends'].'</a>
<a class="title_a_hover" href="'.URL.'/friends/online.php?id='.$id.'" onclick="Page.Go(this.href); return false">'.lang('Друзья','Друзі').' онлайн '.$all_on.'</a> ';
if (!empty($user_id) && $user_id == $id) echo '<a href="'.URL.'/friends/z_in.php" onclick="Page.Go(this.href); return false">'.lang('Входящие','Вхідні').' заявки '.$user['notifications_friends'].'</a>
<a href="'.URL.'/friends/z_out.php" onclick="Page.Go(this.href); return false">'.lang('Исходящие','Вихідні').' заявки</a>';
echo '</div>';
$all_on = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `friends` WHERE `user_id` = '".$arr_user['id']."' AND `online` > '".(time() - 600)."' LIMIT 1"),0);
if ($all_on > 0)
{
$cp = ceil($all/10);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*10-10;
$res = mysql_query("SELECT * FROM `friends` WHERE `user_id` = '".$id."' AND `online` > '".(time() - 600)."' ORDER by `time` DESC LIMIT $start,10");
while ($array = mysql_fetch_array($res))
{
echo '<div class="block">';
echo user_name($array['friend_id']);
if ($user_id == $array['friend_id']) echo '<br/><br/>'; else echo '<ul><a href="'.URL.'/mail/new.php?id='.$array['friend_id'].'" onclick="Page.Go(this.href); return false">'.lang('Написать','Написати').'</a></ul>';
if ($user_id == $array['friend_id']) echo '<br/><br/>'; else echo '<ul><a href="'.URL.'/friends/del.php?del='.$array['friend_id'].'" onclick="Page.Go(this.href); return false">'.lang('Удалить из друзей','Видалити з друзів').'</a></ul>';
echo '</div>';
}
navi($p,$cp,'/friends/online.php?id='.$id.'&');
}
require_once '../incfiles/foot.php';
?>