Файл: m/stats.php
Строк: 169
<?php
session_start();
define('NTOP', 1);
$title = 'Информация о сайте';
require_once('../system/connect.php');
require_once('../system/core.php');
require_once('../system/function.php');
require_once('head.php');
$isset = mysql_query("SELECT * FROM `".$prefix."sait` WHERE `id` = '".$id."'");
if(mysql_num_rows($isset) == 0)
{
echo '<div class="error">';
echo 'Сайта нет в базе! <br/>';
echo '</div>';
}
else
{
$online_sait = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait_online` WHERE `id_sait` = '".$id."'"));
$user = mysql_fetch_array($isset);
if($user['ban'] == 1)
{
echo '<div class="error">';
echo 'Сайта забанен! <br/>';
echo '</div>';
require_once('foot.php');
exit;
}
if($user['status'] == 0)
{
echo '<div class="error">';
echo 'Вы не можете смотреть статистику данного сайта , так как он проходит модерацию! <br/>';
echo '</div>';
require_once('foot.php');
exit;
}
echo '<div class="title2"><strong>'.$user['url'].'</strong> </div>';
echo '<div class="info"><img src="http://mini.s-shot.ru/128x160/160/png/?'.$user['url'].'" alt="'.$user['url'].'" /><br /><br />
<script type="text/javascript" src="//yastatic.net/share/share.js" charset="utf-8"></script><div class="yashare-auto-init" data-yashareL10n="ru" data-yashareType="small" data-yashareQuickServices="vkontakte,facebook,twitter,odnoklassniki,moimir" data-yashareTheme="counter"></div>
</div>';
echo '<div class="title2"><strong>Информация о сайте</strong> </div>';
switch($act)
{
default:
$category = mysql_fetch_array(mysql_query("SELECT * FROM `".$prefix."cat` WHERE `id` = '".$user['category']."'"));
$rat_plus = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."reputation` WHERE `id_sait` = '".$id."' AND `type` = 'plus'"));
$rat_minus = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."reputation` WHERE `id_sait` = '".$id."' AND `type` = 'minus'"));
$all_rat = $rat_plus + $rat_minus;
if($rat_plus > 0)
{
$procent_plus = round(($rat_plus/$all_rat)*100,1);
}
else
{
$procent_plus = '0';
}
if($rat_minus > 0)
{
$procent_minus = round(($rat_minus/$all_rat)*100,1);
}
else
{
$procent_minus = '0';
}
$proverka_reputation = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."reputation` WHERE `ip` = '".$ip."' AND `time` > '".(time()-86400)."' AND `id_sait` = '".$id."'"));
echo '<div class="info">• ID: '.$user['id'].'<br/>';
echo '• Адрес: <a href="http://'.$set['home'].'/out/'.$user['id'].'"><b>'.$user['url'].'</b></a><br/>
• Фавикон: <img src="http://www.google.com/s2/favicons?domain='.$user['url'].'"/><br/>';
echo '• Категория: <a href="http://'.$set['home'].'/m/category/view/'.$user['category'].'">'.$category['name'].'</a><br/>';
echo '• Описание: '.$user['about'].'</div>';
echo '<div class="title2"><strong>Статистика за сегодня</strong></div>
<div class="info">
• Хосты: ['.$user['hosts'].'] <br />
• Хиты: ['.$user['hits'].']<br />
• В топ: ['.$user['in'].'] <br />
• Из топа: ['.$user['out'].'] <br />
• Онлайн: [<a href="http://'.$set['home'].'/stats/'.$id.'/online">'.$online_sait.'</a>] чел</div>';
echo '<div class="title2"><strong>Общая статистика</strong></div>
<div class="info">
• Хосты: '.$user['all_hosts'].' <br />
• Хиты: '.$user['all_hits'].'<br />
• В топ: '.$user['all_in'].' <br />
• Из топа: '.$user['all_out'].'</div>';
echo '<div class="info">Статистика :<br/>';
echo '<strong>Общая</strong>
| <a href="http://'.$set['home'].'/stats/'.$id.'/day">За 7дней</a>
| <a href="http://'.$set['home'].'/stats/'.$id.'/hours">По часам</a>
| <a href="http://'.$set['home'].'/stats/'.$id.'/operators">По операторам</a>';
echo '</div>';
break;
case 'day':
$day = date("d.m");
$day1 = date("d.m", strtotime("-1 day"));
$day2 = date("d.m", strtotime("-2 day"));
$day3 = date("d.m", strtotime("-3 day"));
$day4 = date("d.m", strtotime("-4 day"));
$day5 = date("d.m", strtotime("-5 day"));
$day6 = date("d.m", strtotime("-6 day"));
$online = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait_online` WHERE `id_sait` = '".$id."'"));
echo '<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr class="main">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr class="main"><td>Дата</td><td>Хосты</td><td>Хиты</td></tr>
<tr class="title"><td>'.$day.'</td> <td>'.$user['hosts'].'</td> <td>'.$user['hits'].'</td></tr>
<tr class="title"><td>'.$day1.'</td> <td>'.$user['of_hosts'].'</td> <td>'.$user['of_hits'].'</td></tr>
<tr class="title"><td>'.$day2.'</td> <td>'.$user['hosts1'].'</td> <td>'.$user['hits1'].'</td></tr>
<tr class="title"><td>'.$day3.'</td> <td>'.$user['hosts2'].'</td> <td>'.$user['hits2'].'</td></tr>
<tr class="title"><td>'.$day4.'</td> <td>'.$user['hosts3'].'</td> <td>'.$user['hits3'].'</td></tr>
<tr class="title"><td>'.$day5.'</td> <td>'.$user['hosts4'].'</td> <td>'.$user['hits4'].'</td></tr>
<tr class="title"><td>'.$day6.'</td> <td>'.$user['hosts5'].'</td> <td>'.$user['hits5'].'</td></tr>
</table>';
echo '</div><div class="main">Статистика :<br/>';
echo '<a href="http://'.$set['home'].'/stats/'.$id.'">Общая</a>
| <strong>За 7дней</strong>
| <a href="http://'.$set['home'].'/stats/'.$id.'/hours">По часам</a>
| <a href="http://'.$set['home'].'/stats/'.$id.'/operators">По операторам</a> </div>';
break;
case 'hours':
echo '<tr class="main">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr class="main"><td>Промежуток времени</td><td>Хосты</td><td>Хиты</td></tr>';
for($hour = 0; $hour< 24; $hour++)
{
$start_time = mktime($hour, 0, 0, date("m"), date("d"), date("Y"));
$finish_time = mktime($hour+1, 0, 0, date("m"), date("d"), date("Y"));
$hosts = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."hosts` WHERE `time` BETWEEN '".$start_time."' AND '".$finish_time."' AND `id_sait` = '".$id."'"));
$hits = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."hits` WHERE `time` BETWEEN '".$start_time."' AND '".$finish_time."' AND `id_sait` = '".$id."'"));
if(strlen($hour) == 1)
{
$hour = '0'.$hour;
}
if(strlen($hour + 1) == 1)
{
$f = '0'.($hour + 1);
}
else
{
$f = $f + 1;
}
if($hosts > 0 || $hits > 0){
echo '<tr class="title"><td>'.$hour.':00 - '.($f).':00</td> <td>'.$hosts.'</td> <td>'.$hits.'</td></tr>';
}
}
echo '</table>';
echo '<div class="main">Статистика :<br/>';
echo '<a href="http://'.$set['home'].'/stats/'.$id.'">Общая</a>
| <a href="http://'.$set['home'].'/stats/'.$id.'/day">За 7дней</a>
| <strong>По часам</strong>
| <a href="http://'.$set['home'].'/stats/'.$id.'/operators">По операторам</a></div>';
break;
case 'operators':
$start_time = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
$finish_time = mktime(23, 59, 59, date("m"), date("d"), date("Y"));
$all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."hits` WHERE `time` BETWEEN '".$start_time."' AND '".$finish_time."' AND `id_sait` = '".$id."'"));
$opera = mysql_query("SELECT DISTINCT `".$prefix."hits`.`operator`, COUNT(`".$prefix."hits`.`operator`) AS `count`, `".$prefix."ip_name`.`operator` as `name` FROM `".$prefix."hits`, `".$prefix."ip_name` WHERE `".$prefix."hits`.`id_sait` = '".$id."' AND `".$prefix."hits`.`time` BETWEEN '".$start_time."' AND '".$finish_time."' AND `".$prefix."hits`.`operator` = `".$prefix."ip_name`.`id` GROUP BY `".$prefix."hits`.`operator` ORDER BY 2 DESC");
$oper_count = mysql_num_rows($opera);
if($oper_count > 0)
{
echo '<tr class="title">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr class="main"><td>Оператор</td><td>Хиты</td><td>Проценты</td></tr>';
$total=intval(($oper_count-1)/$pages)+1;
$page=abs(intval($_GET['page']));
if(empty($page) OR $page < 0)
{
$page = 1;
}
if($page > $total)
{
$page = $total;
}
$past=intval($oper_count/$pages);
$start=$page*$pages-$pages;
$oper = mysql_query("SELECT DISTINCT `".$prefix."hits`.`operator`, COUNT(`".$prefix."hits`.`operator`) AS `count`, `".$prefix."ip_name`.`operator` as `name` FROM `".$prefix."hits`, `".$prefix."ip_name` WHERE `".$prefix."hits`.`id_sait` = '".$id."' AND `time` BETWEEN '".$start_time."' AND '".$finish_time."' AND `".$prefix."hits`.`operator` = `".$prefix."ip_name`.`id` GROUP BY `".$prefix."hits`.`operator` ORDER BY 2 DESC LIMIT ".$start.",".$pages."");
while($op = mysql_fetch_array($oper)){
$strana = mysql_fetch_array(mysql_query("SELECT * FROM `".$prefix."ip_name` WHERE `operator` = '".$op['name']."'"));
$procent = ($op['count'] / $all) * 100;
echo '<tr class="title"><td>['.$strana['coun'].']'.$op['name'].'</td><td><b>'.$op['count'].'</b> ('.$strana['country'].'): <b></td><td>['.round($procent, 2).'%</b>]</td><td>';}
echo'</table>';
navigation($oper_count,$pages,$page,'http://'.$set['home'].'/stats/'.$id.'/operators/',$total);
}else{
echo 'Нет статистики по операторам для этого сайта сегодня.</div>';}
echo '<div class="main">Статистика :<br/>';
echo '<a href="http://'.$set['home'].'/stats/'.$id.'">Общая</a>
| <a href="http://'.$set['home'].'/stats/'.$id.'/day">За 7дней</a>
| <a href="http://'.$set['home'].'/stats/'.$id.'/hours">По часам</a>
| <strong>По операторам</strong></div>';
break;
case 'online':
$all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait_online` WHERE `id_sait` = '".$id."'"));
if($all != 0)
{
echo '<tr class="title">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr class="main"><td>IP</td><td>UA</td><td>Время</td></tr>';
$total=intval(($all-1)/$pages)+1;
$page=abs(intval($_GET['page']));
if(empty($page) OR $page < 0)
{
$page = 1;
}
if($page > $total)
{
$page = $total;
}
$past=intval($all/$pages);
$start=$page*$pages-$pages;
$onl = mysql_query("SELECT * FROM `".$prefix."sait_online` WHERE `id_sait` = '".$id."' LIMIT ".$start.",".$pages."");
while($row = mysql_fetch_array($onl))
{
echo '<tr class="title"><td>'.$row['ip'].'</td> <td>'.$row['ua'].'</td> <td>'.data($row['time']).'</td></tr>';
}
echo '</table>';
navigation($all,$pages,$page,'http://'.$set['home'].'/stats/'.$id.'/online/',$total);
}
else
{
echo 'Нет статистики по онлайн для этого сайта сегодня.<br/>';
}
echo '<div class="main">Статистика :<br/>';
echo '<a href="http://'.$set['home'].'/stats/'.$id.'">Общая</a>
| <a href="http://'.$set['home'].'/stats/'.$id.'/day">За 7дней</a>
| <a href="http://'.$set['home'].'/stats/'.$id.'/hours">По часам</a>
| <a href="http://'.$set['home'].'/stats/'.$id.'/operators">По операторам</a> | <strong>Онлайн</strong></div>';
break;
}
}
require_once('foot.php');
?>