Файл: user/friends/online.php
Строк: 73
<?php
require_once '../../sys/inc/start.php';
require_once '../../sys/inc/compress.php';
require_once '../../sys/inc/sess.php';
require_once '../../sys/inc/settings.php';
require_once '../../sys/inc/db_connect.php';
require_once '../../sys/inc/ipua.php';
require_once '../../sys/inc/fnc.php';
require_once '../../sys/inc/user.php';
only_reg();
$set['title'] = 'Список друзей';
require_once '../../sys/inc/thead.php';
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);
$k_online = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` INNER JOIN `user` ON `friends`.`friends`=`user`.`id` WHERE `friends`.`user` = '$ank[id]' AND `friends`.`i` = '1' AND `user`.`date_last`>'" . (time() - 300) . "'"), 0);
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user` = '$ank[id]' AND `i` = '1'"), 0);
$k_z = mysql_result(mysql_query("SELECT COUNT(id) FROM `friends_new` WHERE `to` = '$ank[id]'"), 0);
echo "<div class = 'tabs t_bar clear_fix'>";
echo "<a href = '/user/friends/'>Друзья [$k_post]</a>";
echo "<a href = '/user/friends/new.php'>Заявки [$k_z]</a>";
echo "<a href = '/user/friends/online.php' class = 'active'>Онлайн [$k_online]</a>";
echo "</div>";
if ($k_post == 0) {
echo "<table class = 'foot'><tr><td class = 'null'>";
echo "<img src = '/style/icons/bullet_error.png' /> Нет друзей онлайн";
echo "</td></tr></table>";
}
$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` INNER JOIN `user` ON `friends`.`friends`=`user`.`id` WHERE `friends`.`user` = '$ank[id]' AND `friends`.`i` = '1' AND `user`.`date_last`>'" . (time() - 300) . "' ORDER BY `user`.`date_last` DESC LIMIT $start, $set[p_str]");
while ($f = mysql_fetch_array($q)) {
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[friends]' LIMIT 1"));
echo "<table class = 'f8'><tr><td class = 'icon48'>";
avatar($ank['id'], '48');
echo "</td><td class = 'null'>";
user($ank['id']);
echo "<br/>";
echo "<img src = '/style/icons/time.png' /> " . vremja($f['time']);
echo "</td></tr></table>";
}
if ($k_page > 1) {
str("?id=$ank[id]&", $k_page, $page);
}
require_once '../../sys/inc/tfoot.php';