Файл: user/friends/online.php
Строк: 76
<?php
/* DCMS S (Special)
* Версия файла 0.0.1
* Дата последнего редактирования 28.10.2015
* Модифицировал densnet
*/
require_once '../../sys/inc/start.php';
require_once H . 'sys/inc/compress.php';
require_once H . 'sys/inc/sess.php';
require_once H . 'sys/inc/settings.php';
require_once H . 'sys/inc/db_connect.php';
require_once H . 'sys/inc/ipua.php';
require_once H . 'sys/inc/fnc.php';
require_once H . 'sys/inc/user.php';
user::only_reg();
$set['title'] = 'Список друзей';
require_once H . '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;
}
echo "<div style = 'font-size: 18px;font-weight: bold;' class = 'comm'>Друзья</div>";
$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="busi_switcher"><table><tr><td style = "width: 33%;">';
echo "<a class = 'brd' href = 'index.php'>Друзья <b>$k_post</b></a>";
echo '</td><td style = "width: 33%;">';
echo "<a class = 'brd' href = 'new.php'>Заявки <b>$k_z</b></a>";
echo '</td><td style = "width: 33%;">';
echo "<a class = 'active brd'>Онлайн <b>$k_online</b></a>";
echo '</td></tr></table></div>';
if ($k_online == 0) {
echo "<div class = 'errs'>";
echo "<img src = '/style/icons/error.png' /> Нет результатов";
echo "</div>";
}
$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 = 'comm'><tr><td class = 'icon14'>";
avatar($ank['id'], '48');
echo "</td><td class = 'null'>";
user($ank['id']);
echo "<br/>";
echo "<a href = '/user/mail/?new_message=$ank[id]' class = 'add'><img src = '/style/icons/mails.png' /> Сообщение</a>";
echo "</td></tr></table>";
}
if ($k_page > 1) {
str("?id=$ank[id]&", $k_page, $page);
}
require_once H . 'sys/inc/tfoot.php';