Файл: wapxl.ru/shaxty/aktiv.php
Строк: 59
<?php
function aktiv($ref, $times)
{
global $db, $user, $time;
if($times!=0){
$tttime = '`time` > '.($time - (3600 * $times)).' AND';
$tttime0 = 'where `time` > '.($time - (3600 * $times)).'';
}
// stena
$s0=mysql_result(mysql_query("select count(*) as num from stena ".$tttime0.""),0);
$s1=mysql_result(mysql_query("select count(*) as num from stena where ".$tttime." mgs_id = '".$ref."'"),0);
//newskom
$nk0=mysql_result(mysql_query("select count(*) as num from newskom ".$tttime0.""),0);
$nk1=mysql_result(mysql_query("select count(*) as num from newskom where ".$tttime." user_id = '".$ref."'"),0);
//forum_msg
$fm0=mysql_result(mysql_query("select count(*) as num from `forum_msg` WHERE ".$tttime." `forum_msg`.`del` != '1'"),0);
$fm1=mysql_result(mysql_query("select count(*) as num from `forum_msg` WHERE ".$tttime." user_id = '".$ref."' AND `forum_msg`.`del` != '1';"),0);
// gbook
$gbook0=mysql_result(mysql_query("select count(*) as num from gbook ".$tttime0.""),0);
$gbook1=mysql_result(mysql_query("select count(*) as num from gbook where ".$tttime." user_id = '".$ref."'"),0);
// group_newskom
$grnk0=mysql_result(mysql_query("select count(*) as num from group_newskom ".$tttime0.""),0);
$grnk1=mysql_result(mysql_query("select count(*) as num from group_newskom where ".$tttime." user_id = '".$ref."'"),0);
// group_chat
$grchat0=mysql_result(mysql_query("select count(*) as num from group_chat ".$tttime0.""),0);
$grchat1=mysql_result(mysql_query("select count(*) as num from group_chat where ".$tttime." user_id = '".$ref."'"),0);
// komments
$komm0=mysql_result(mysql_query("select count(*) as num from komments ".$tttime0.""),0);
$komm1=mysql_result(mysql_query("select count(*) as num from komments where ".$tttime." user_id = '".$ref."'"),0);
$count0= $s0+$nk0+$fm0+$gbook0+$grnk0+$grchat0+$komm0; // Прибовляем общее кол-во постов
$count1= $s1+$nk1+$fm1+$gbook1+$grnk1+$grchat1+$komm1; // Прибовляем кол-во постов написанное юзером $ref
$count = round(100 / $count0 * $count1);
return $count;
}
?>