Файл: vsime.com/friends/count_user.php
Строк: 37
<?
// считаем друзей
$array_res = array();
$count = array();
$query_res = mysqli_query($dbi, "SELECT * FROM `friends` WHERE (`id_user` = '$ank[id]' OR `id_ank` = '$ank[id]') AND `ok` = '1'");
while ($post_res = mysqli_fetch_array($query_res))
{
if ($ank['id'] != $post_res['id_user'])$ank_res = profile($post_res['id_user']); else $ank_res = profile($post_res['id_ank']);
$array_res[] = $ank_res['id'];
}
$count['friends'] = count($array_res);
$where = implode("' OR `id` = '", $array_res);
if ($count['friends'] != 0)$count['friends_online'] = mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `user` WHERE (`id` = '$where') AND `date_last` > '".($time-600)."'")); else $count['friends_online'] = 0;
echo "($count[friends]".($count['friends_online'] != 0?"/<span class='spagr'>$count[friends_online]</span>":NULL).")";
?>