Файл: infos.php
Строк: 181
<?php
session_start();
define('MKTOP', 1);
require_once('system/connect.php');
require_once('system/core.php');
require_once('system/function.php');
$isset = mysql_query("SELECT * FROM `sait` WHERE `id` = '".$id."'");
if(mysql_num_rows($isset) == 0){
$title = 'Ошибка';
require_once('head.php');
echo '<div class="text">Такого сайта нет в базе</div>';
require_once('foot.php');
exit;
}
$online_sait = mysql_num_rows(mysql_query("SELECT * FROM `sait_online` WHERE `id_sait` = '".$id."'"));
$user = mysql_fetch_array($isset);
if($user['ban'] == 1 AND $user_data['level'] <= 1){
$title = 'Ошибка';
require_once('head.php');
echo '<div class="text">Сайт заблокирован</div>';
require_once('foot.php');
exit;
}
if($user['status'] == 0 AND $user_data['level'] <= 1){
$title = 'Ошибка';
require_once('../head.php');
echo '<div class="text">Сайт на модерации</div>';
require_once('foot.php');
exit;
}
switch($act){
default:
$title = $user['name'];
require_once('head.php');
$category = mysql_fetch_array(mysql_query("SELECT * FROM `cat` WHERE `id` = '".$user['category']."'"));
echo '<div class="text">ID: '.$user['id'].'</div>';
echo '<a class="link" href="/out/'.$user['id'].'.php">Адрес: http://'.$user['url'].'</a>';
echo '<a class="link" href="/cat.php?act=view&id='.$user['category'].'">Категория: '.$category['name'].'</a>';
echo '<a class="link" href="/info/online_'.$id.'.php">Сейчас на сайте: '.$online_sait.'</a>';
if(isset($user_data) AND $user_data['level'] >= 2 AND $user['ban'] == 1){
echo '<div class="text">Сайт заблокирован</div>';
echo '<div class="text">Дата блокировки: '.data($user['ban_time']).'</div>';
if($user_data['level'] == 3){
if($user['ban_who'] != 0){
$ban_who = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$user['ban_who']."'"));
echo '<a class="link" href="/adminka/users.php?act=user&id='.$mod['id'].'">Заблокировал: '.$ban_who['login'].'</a>';
}
else echo '<div class="text">Заблокирован системой</div>';
}
}
if(isset($user_data) AND $user_data['level'] >= 2 AND $user['status'] == 0)
echo '<div class="text">Сайт на модерации</div>';
else if($user['hosts'] <= 0 AND $user['ban'] == 0) echo '<div class="text">Сайт не учавствует в топ-100</div>';
echo '<div class="text">Описание: '.$user['about'].' </div>';
$day = mysql_fetch_array(mysql_query("SELECT * FROM `sait` WHERE `id` = '".$id."'"));
$online = mysql_num_rows(mysql_query("SELECT * FROM `sait_online` WHERE `id_sait` = '".$id."'"));
$polzovatel = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$user['id_user']."'"));
if($user_data['level'] == 3) echo '<a class="link" href="/adminka/users.php?act=user&id='.$polzovatel['id'].'">Добавил: '.$polzovatel['login'].'</a>';
if($user_data['level'] == 3) echo '<div class="text">Дата добавления: '.data($user['time_reg']).'</div>';
if($user['status'] == 1 AND$user_data['level'] == 3){
$mod = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$user['id_mod']."'"));
echo '<a class="link" href="/adminka/users.php?act=user&id='.$mod['id'].'">Активировал: '.$mod['login'].'</a>';
echo '<div class="text">Дата активации: '.data($user['time_activ']).'</div>';
}
echo'<div class="title">тИЦ и PR сайта '.$user['url'].'</div><div class="text"><img src="http://knopki.info/informer/lite5.gif?site='.$user['url'].'" alt="seo icon '.$user['url'].'" /></a></div>';
echo '<div class="title">Статистика на сегодня:</div>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr><td class="tab">Хосты</td><td class="tab">Хиты</td><td class="tab">В топ</td><td class="tab">Из топа</td></tr>
<tr><td class="tab">'.$day['hosts'].'</td><td class="tab">'.$day['hits'].'</td><td class="tab">'.$day['in'].'</td><td class="tab">'.$day['out'].'</td></tr></table>
<div class="title">Статистика на вчера:</div>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr><td class="tab">Хосты</td><td class="tab">Хиты</td><td class="tab">В топ</td><td class="tab">Из топа</td></tr>
<tr><td class="tab">'.$day['hosts2'].'</td><td class="tab">'.$day['hits2'].'</td><td class="tab">'.$day['in2'].'</td><td class="tab">'.$day['out2'].'</td></tr></table>
<div class="title">Общая статистика:</div>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr><td class="tab">Хосты</td><td class="tab">Хиты</td><td class="tab">В топ</td><td class="tab">Из топа</td></tr>
<tr><td class="tab">'.$day['all_hosts'].'</td><td class="tab">'.$day['all_hits'].'</td><td class="tab">'.$day['all_in'].'</td><td class="tab">'.$day['all_out'].'</td></tr></table>
<a class="link" href="/info/days_'.$id.'.php">Статистика по дням</a>
<a class="link" href="/info/hours_'.$id.'.php">Статистика по часам</a>
<a class="link" href="/info/ip_'.$id.'.php">Статистика по IP</a>';
if(isset($user_data) AND $user_data['level'] >= 2){
echo '<div class="text"><a href="/adminka/platforms.php?act=edit_sait&id='.$id.'">Редактировать</a> ';
if($day['ban'] == 1) echo '<a href="/adminka/platforms.php?act=ban&id='.$id.'">Разблокировать</a> ';
else echo '<a href="/adminka/platforms.php?act=ban&id='.$id.'">Заблокировать</a> ';
if($day['status'] != 1) echo '<a href="/adminka/moderacia.php?act=activate&id='.$id.'">Активировать</a> ';
echo '<a href="/adminka/platforms.php?act=del_sait&id='.$id.'">Удалить</a></div>';
}
break;
case 'days':
$title = 'Статистика по дням';
require_once('head.php');
$day = mysql_fetch_array(mysql_query("SELECT * FROM `sait` WHERE `id` = '".$id."'"));
echo '<div class="nav"><img src="/graphic/'.$id.'.jpg" alt="График"></div>';
echo '<table width="100%" border="0" cellspacing="1" cellpadding="2">';
echo '<tr><td class="tab">Дата</td><td class="tab">Хосты</td><td class="tab">Хиты</td><td class="tab">В топ</td><td class="tab">Из топа</td></tr>';
echo '<tr><td class="tab">'.date('d.m').'</td><td class="tab">'.$day['hosts'].'</td><td class="tab">'.$day['hits'].'</td><td class="tab">'.$day['in'].'</td><td class="tab">'.$day['out'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-1 day")).'</td><td class="tab">'.$day['hosts2'].'</td><td class="tab">'.$day['hits2'].'</td><td class="tab">'.$day['in2'].'</td><td class="tab">'.$day['out2'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-2 day")).'</td><td class="tab">'.$day['hosts3'].'</td><td class="tab">'.$day['hits3'].'</td><td class="tab">'.$day['in3'].'</td><td class="tab">'.$day['out3'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-3 day")).'</td><td class="tab">'.$day['hosts4'].'</td><td class="tab">'.$day['hits4'].'</td><td class="tab">'.$day['in4'].'</td><td class="tab">'.$day['out4'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-4 day")).'</td><td class="tab">'.$day['hosts5'].'</td><td class="tab">'.$day['hits5'].'</td><td class="tab">'.$day['in5'].'</td><td class="tab">'.$day['out5'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-5 day")).'</td><td class="tab">'.$day['hosts6'].'</td><td class="tab">'.$day['hits6'].'</td><td class="tab">'.$day['in6'].'</td><td class="tab">'.$day['out6'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-6 day")).'</td><td class="tab">'.$day['hosts7'].'</td><td class="tab">'.$day['hits7'].'</td><td class="tab">'.$day['in7'].'</td><td class="tab">'.$day['out7'].'</td></tr>';
echo '<tr><td class="tab">'.date('d.m', strtotime("-7 day")).'</td><td class="tab">'.$day['hosts8'].'</td><td class="tab">'.$day['hits8'].'</td><td class="tab">'.$day['in8'].'</td><td class="tab">'.$day['out8'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-8 day")).'</td><td class="tab">'.$day['hosts9'].'</td><td class="tab">'.$day['hits9'].'</td><td class="tab">'.$day['in9'].'</td><td class="tab">'.$day['out9'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-9 day")).'</td><td class="tab">'.$day['hosts10'].'</td><td class="tab">'.$day['hits10'].'</td><td class="tab">'.$day['in10'].'</td><td class="tab">'.$day['out10'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-10 day")).'</td><td class="tab">'.$day['hosts11'].'</td><td class="tab">'.$day['hits11'].'</td><td class="tab">'.$day['in11'].'</td><td class="tab">'.$day['out11'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-11 day")).'</td><td class="tab">'.$day['hosts12'].'</td><td class="tab">'.$day['hits12'].'</td><td class="tab">'.$day['in12'].'</td><td class="tab">'.$day['out12'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-12 day")).'</td><td class="tab">'.$day['hosts13'].'</td><td class="tab">'.$day['hits13'].'</td><td class="tab">'.$day['in13'].'</td><td class="tab">'.$day['out13'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-13 day")).'</td><td class="tab">'.$day['hosts14'].'</td><td class="tab">'.$day['hits14'].'</td><td class="tab">'.$day['in14'].'</td><td class="tab">'.$day['out14'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-14 day")).'</td><td class="tab">'.$day['hosts15'].'</td><td class="tab">'.$day['hits15'].'</td><td class="tab">'.$day['in15'].'</td><td class="tab">'.$day['out15'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-15 day")).'</td><td class="tab">'.$day['hosts16'].'</td><td class="tab">'.$day['hits16'].'</td><td class="tab">'.$day['in16'].'</td><td class="tab">'.$day['out16'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-16 day")).'</td><td class="tab">'.$day['hosts17'].'</td><td class="tab">'.$day['hits17'].'</td><td class="tab">'.$day['in17'].'</td><td class="tab">'.$day['out17'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-17 day")).'</td><td class="tab">'.$day['hosts18'].'</td><td class="tab">'.$day['hits18'].'</td><td class="tab">'.$day['in18'].'</td><td class="tab">'.$day['out18'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-18 day")).'</td><td class="tab">'.$day['hosts19'].'</td><td class="tab">'.$day['hits19'].'</td><td class="tab">'.$day['in19'].'</td><td class="tab">'.$day['out19'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-19 day")).'</td><td class="tab">'.$day['hosts20'].'</td><td class="tab">'.$day['hits20'].'</td><td class="tab">'.$day['in20'].'</td><td class="tab">'.$day['out20'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-20 day")).'</td><td class="tab">'.$day['hosts21'].'</td><td class="tab">'.$day['hits21'].'</td><td class="tab">'.$day['in21'].'</td><td class="tab">'.$day['out21'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-21 day")).'</td><td class="tab">'.$day['hosts22'].'</td><td class="tab">'.$day['hits22'].'</td><td class="tab">'.$day['in22'].'</td><td class="tab">'.$day['out22'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-22 day")).'</td><td class="tab">'.$day['hosts23'].'</td><td class="tab">'.$day['hits23'].'</td><td class="tab">'.$day['in23'].'</td><td class="tab">'.$day['out23'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-23 day")).'</td><td class="tab">'.$day['hosts24'].'</td><td class="tab">'.$day['hits24'].'</td><td class="tab">'.$day['in24'].'</td><td class="tab">'.$day['out24'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-24 day")).'</td><td class="tab">'.$day['hosts25'].'</td><td class="tab">'.$day['hits25'].'</td><td class="tab">'.$day['in25'].'</td><td class="tab">'.$day['out25'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-25 day")).'</td><td class="tab">'.$day['hosts26'].'</td><td class="tab">'.$day['hits26'].'</td><td class="tab">'.$day['in26'].'</td><td class="tab">'.$day['out26'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-26 day")).'</td><td class="tab">'.$day['hosts27'].'</td><td class="tab">'.$day['hits27'].'</td><td class="tab">'.$day['in27'].'</td><td class="tab">'.$day['out27'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-27 day")).'</td><td class="tab">'.$day['hosts28'].'</td><td class="tab">'.$day['hits28'].'</td><td class="tab">'.$day['in28'].'</td><td class="tab">'.$day['out28'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-28 day")).'</td><td class="tab">'.$day['hosts29'].'</td><td class="tab">'.$day['hits29'].'</td><td class="tab">'.$day['in29'].'</td><td class="tab">'.$day['out29'].'</td></tr>';
echo '<tr><td class="tab">'.date("d.m", strtotime("-29 day")).'</td><td class="tab">'.$day['hosts30'].'</td><td class="tab">'.$day['hits30'].'</td><td class="tab">'.$day['in30'].'</td><td class="tab">'.$day['out30'].'</td></tr></table>';
echo '<a class="link" href="/info/'.$id.'.php">Информация о сайте</a>';
break;
case 'hours':
$title = 'Статистика по часам';
require_once('head.php');
echo '<tr class="text">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr><td class="tab">Часы</td><td class="tab">Хосты</td><td class="tab">Хиты</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 `hosts` WHERE `time` BETWEEN '".$start_time."' AND '".$finish_time."' AND `id_sait` = '".$id."'"));
$hits = mysql_num_rows(mysql_query("SELECT * FROM `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;
echo '<tr class=""><td class="tab">'.$hour.':00 - '.($f).':00</td> <td class="tab">'.$hosts.'</td> <td class="tab">'.$hits.'</td></tr>';
}
echo '</table>';
echo '<a class="link" href="/info/'.$id.'.php">Информация о сайте</a>';
break;
case 'ip':
$title = 'Статистика по IP';
require_once('head.php');
$start_time = mktime(00, 00, 00, date("m"), date("d"), date("Y"));
$finish_time = mktime(23, 59, 59, date("m"), date("d"), date("Y"));
$al = mysql_query("SELECT COUNT(`ip`) FROM `hits` WHERE `time` BETWEEN '".$start_time."' AND '".$finish_time."' AND `id_sait` = '".$id."'");
$all = mysql_result($al,0);
$count = mysql_num_rows(mysql_query("SELECT DISTINCT `ip` as `ip`, COUNT(`ip`) AS `count` FROM `hits` WHERE `time` BETWEEN '".$start_time."' AND '".$finish_time."' AND `id_sait` = '".$id."' GROUP BY `ip`"));
if($count > 0){
echo '<table width="100%" cellspacing="1" cellpadding="2">
<tr><td class="tab">IP</td><td class="tab">Хиты</td><td class="tab">Проценты</td></tr>';
$total=intval(($count-1)/$pages)+1;
$page=abs(intval($_GET['page']));
if(empty($page) OR $page < 0) $page = 1;
if($page > $total) $page = $total;
$past=intval($count/$pages);
$start=$page*$pages-$pages;
$query = mysql_query("SELECT DISTINCT `ip` as `ip`, COUNT(`ip`) AS `count` FROM `hits` WHERE `time` BETWEEN '".$start_time."' AND '".$finish_time."' AND `id_sait` = '".$id."' GROUP BY `ip` LIMIT ".$start.",".$pages."");
while($stata = mysql_fetch_array($query)){
$procent = ($stata['count'] / $all) * 100;
echo '<tr><td class="tab">'.$stata['ip'].'</td> <td class="tab">'.$stata['count'].'</td> <td class="tab">'.round($procent, 1).'%</td></tr>';
}
echo '</table>';
navigation($count,$pages,$page,'/infos.php?act=ip&id='.$id.'&',$total);
}
else echo '<div class="text">Нет статистики по IP для этого сайта на сегодня</div>';
echo '<a class="link" href="/info/'.$id.'.php">Информация о сайте</a>';
break;
case 'online':
$title = 'Сейчас на сайте';
require_once('head.php');
$all = mysql_num_rows(mysql_query("SELECT * FROM `sait_online` WHERE `id_sait` = '".$id."'"));
if($all != 0){
echo '<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr><td class="tab">IP</td><td class="tab">UA</td><td class="tab">Время</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 `sait_online` WHERE `id_sait` = '".$id."' LIMIT ".$start.",".$pages."");
while($row = mysql_fetch_array($onl)) echo '<tr><td class="tab">'.$row['ip'].'</td> <td class="tab">'.$row['ua'].'</td> <td class="tab">'.data($row['time']).'</td></tr>';
echo '</table>';
navigation($all,$pages,$page,'/infos.php?act=online&id='.$id.'&',$total);
}
else echo '<div class="text">Сейчас на сайте никого нет</div>';
echo '<a class="link" href="/info/'.$id.'.php">Информация о сайте</a>';
break;
}
require_once('foot.php');
?>