Файл: PROFIWM.COM/top/weeks.php
Строк: 55
<?php
// by -=ШАХТЕР=- (waphp.ru - качай только тут)
include 'config.php';
//---------------------------------------------------------------
//---------------------------------------------------------------
$title='Статистика';
include_once 'head.php';
echo "".$div1."Статистика</div>";
// ------------------------------ вывод статистики пользователя ---------------------
//проверка ввода id
if (empty($_GET['uid']))
{
echo "<b>Ошибка!</b>n";
print ''.$div4.'<a href="'.$rating_url.'index.php">'.$site_name.'</a> <img src="img/gt.gif" alt=">" /> Статистика</div>';
include "foot_code.php";
exit;
}
$uid=(int)check($_GET['uid']);
// проверка существования учетной записи
$result = mysql_query("SELECT * FROM top_users WHERE uid=$uid");
$row=mysql_fetch_array($result);
if (empty($row))
{
echo "<b>Ошибка!</b>n";
print ''.$div4.'<a href="'.$rating_url.'index.php">'.$site_name.'</a> <img src="img/gt.gif" alt=">" /> Статистика</div>';
include "foot_code.php";
exit;
}
$act = check($_GET['act']);
$site_names = esc2($row['site_name']);
$link = esc2($row['link']);
$admin = esc2($row['admin']);
$info = esc2($row['info']);
//----------------------- Место в топе---------------------------
$result = mysql_query("SELECT * FROM `weeks` WHERE `host` >= $host_today AND `date`=$today ORDER BY `host` DESC;");
@$top_place = mysql_num_rows($result);
$page = ceil($top_place/$count_top);
// день недели сегодня
$week_day = date("w");
// расчитываем дату обнуления
$dayNext =$week_day + 7;
if ($dayNext > 7){
$dayNext-=7;
}
$cntDay=8-$dayNext;
$nextMonday=date("Ymd",mktime(0,0,0,date("m"),date("d")+$cntDay));
// сегодня
$today = date("Ymd");
for ($i=1;$i<7;$i++)
{
// данные за неделю
$result = mysql_query("SELECT count FROM weeks WHERE next_mon=$nextMonday AND day_week=$i AND uid=$uid LIMIT 1");
$row=mysql_fetch_row($result);
// поверка наличия записи в базе
if (empty($row[0]))
{
$week_data[$i] = 0;
}else $week_data[$i] = $row[0];
}
$result = mysql_query("SELECT * FROM weeks WHERE uid=$uid LIMIT 7");
echo "<br /><p><div class="ifield">Статистика за неделю:</div>";
// Выводим заголовок таблицы:
echo "<table border="1" width="30%" bgcolor="#e5e5e5">";
echo "<tr><td>Дата</td><td>Хосты</td><td>Хиты</td></tr>";
// Выводим таблицу:
$week_day = date("w");
for ($c=0; $c<mysql_num_rows($result); $c++)
{
echo "<tr>";
$f = mysql_fetch_array($result);
$date=strtr($f['date'],array('01'=>'.01','02'=>'.02','03'=>'.03','04'=>'.04','05'=>'.05','06'=>'.06','07'=>'.07','08'=>'.08','09'=>'.09','10'=>'.10','11'=>'.11','12'=>'.12','2010'=>'2010','2011'=>'2011','2012'=>'2012','2013'=>'2013','2014'=>'2014','2015'=>'2015'));
echo "<td>$date</td><td>$f[host]</td><td>$f[count]</td></tr>";
}
$result0 = mysql_query("SELECT sum(count),sum(host) FROM months WHERE uid = $uid");
$row=mysql_fetch_row($result0);
$all_hits = (int)$row[0];
$all_hosts = (int)$row[1];
echo "<td><b>Всего</b></td><td><b>$all_hosts</b></td><td><b>$all_hits</b></td></tr>";
echo "<td><b>В среднем</b></td><td><b>".round($all_hosts/mysql_num_rows($result))."</b></td><td><b>".round($all_hits/mysql_num_rows($result))."</b></td></tr>";
echo "</table></p>";
echo "<b>Графики:</b><br/>Хосты<br />";
echo "<img src="graphic_72.php?uid=$uid" alt="неделя" /><br /> Хиты<br /> <img src="graphic_7.php?uid=$uid" alt="неделя" /><br/>n";
echo "<br /><a href='stat.php?uid=$uid'>Статистика</a><br/>";
print ''.$div4.'<a href="'.$rating_url.'index.php">'.$site_name.'</a> <img src="img/gt.gif" alt=">" /> <a href="index.php?p='.$page.'">'.$link.'</a> <img src="img/gt.gif" alt=">" /> Статистика</div>';
include "foot_code.php";
?>