Файл: infos.php
Строк: 157
<?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 '<div class="text"><img src="http://mini.s-shot.ru/140x320/240/png/?http://'.$user['url'].'" align="top" alt="Скриншот сайта '.$user['url'].'"/></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="/infos.php?act=online&id='.$id.'">Сейчас на сайте: '.$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="text">Статистика на сегодня:</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="text">Статистика на вчера:</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="text">Общая статистика:</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="/infos.php?act=days&id='.$id.'">Статистика по дням</a>
<a class="link" href="/infos.php?act=hours&id='.$id.'">Статистика по часам</a>
<a class="link" href="/infos.php?act=ip&id='.$id.'">Статистика по 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></table>';
echo '<a class="link" href="/infos.php?id='.$id.'">Информация о сайте</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="/infos.php?id='.$id.'">Информация о сайте</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="/infos.php?id='.$id.'">Информация о сайте</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="/infos.php?id='.$id.'">Информация о сайте</a>';
break;
}
require_once('foot.php');
?>