Файл: top/index.php
Строк: 169
<?php
include("verh.php");
include("config.php");
if (empty($_GET['p'])) $page = 1;
else $page=$_GET['p'];
if (empty($_GET['uid'])) $action = "";
else $action="view";
switch ($action) {
case "view":
if (empty($_GET['uid'])) exit;
$uid=(int)$_GET['uid'];
$result = mysql_query("SELECT site_name,link FROM users WHERE uid=$uid");
$row=mysql_fetch_row($result);
if (empty($row[0])) exit;
$site = $row[0];
$link = $row[1];
$today = date("Ymd", time()+3600);
$hour = date("H");
$result = mysql_query("SELECT sum(count),sum(host) FROM count_24 WHERE date=$today AND uid=$uid");
$row = mysql_fetch_row($result);
$count_today = (int)$row[0];
$host_today = (int)$row[1];
$result = mysql_query("SELECT sum(count),sum(host) FROM count_24 WHERE (date=$today-1 AND hour>$hour) OR (date=$today AND hour<=$hour) AND uid=$uid");
$row = mysql_fetch_row($result);
$count_24 = (int)$row[0];
$host_24 = (int)$row[1];
$result = mysql_query("SELECT count,host FROM count_24 WHERE hour=$hour AND date=$today AND uid=$uid");
$row=mysql_fetch_row($result);
if (empty($row[0]))
{
$hour_count = 0;
$hour_host = 0;
}else{
$hour_count = (int)$row[0];
$hour_host = (int)$row[1];
}
$months = array("Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь");
$today = date("Ym");
$index_month = date("m")-1;
$result = mysql_query("SELECT count,host FROM months WHERE date=$today AND uid=$uid");
$row=mysql_fetch_row($result);
if (empty($row[0]))
{
$this_month_count = 0;
$this_month_host = 0;
}else{
$this_month_count = (int)$row[0];
$this_month_host = (int)$row[1];
}
$week_day = date("w");
$today = date("Ymd", time()+3600);
$result = mysql_query("SELECT sum(count),sum(host) FROM weeks WHERE uid=$uid");
$row=mysql_fetch_row($result);
$total_week_count = (int)$row[0];
$total_week_host = (int)$row[1];
$result = mysql_query("SELECT count(*) FROM online_ip WHERE uid=$uid");
$row=mysql_fetch_row($result);
$online=(int)$row[0];
$result = mysql_query("SELECT sum(count),sum(host) FROM months WHERE uid=$uid");
$row=mysql_fetch_row($result);
$all_hits = (int)$row[0];
$all_hosts = (int)$row[1];
$result=mysql_query("SELECT count(*) FROM weeks WHERE host >= $host_today and date=$today ORDER BY host DESC");
$row=mysql_fetch_row($result);
$top_place = (int)$row[0];
$user_data = mysql_query("SELECT date FROM users WHERE uid=$uid");
$user_data_row = mysql_fetch_array($user_data);
$date_reg = date("d.m.y",$user_data_row['date']);
$page=ceil($top_place/$count_top);
echo'
<div class="cent">
Мобильный рейтинг сайтов!<br />
Cтатистика участников ТОПа сайтов<br />
</div>';
echo "<div class='hefo'><a href="$link">$link</a></div><div class='cent'>";
echo "<div class='li_orange'>» <b>Сегодня:</b><br />» Хостов: $host_today<br />
» Хитов: $count_todayn<br /></div>
<div class='li_orange'>» <b>За этот час:</b><br />» Хостов: $hour_host<br />» Хитов: $hour_countn<br /></div>
<div class='li_orange'>» <b>За неделю:</b><br />» Хостов: $total_week_host<br />
» Хитов: $total_week_countn<br /></div>
<div class='li_orange'>» <b>В этом месяце (".$months[$index_month].")</b><br />
» Хостов: $this_month_host<br />» Хитов: $this_month_count n<br /></div>
<div class='li_orange'>» <b>Всего с момента регистрации ($date_reg)</b><br />
» Хостов: $all_hosts<br />» Хитов: $all_hits n</div>
<div class='li_orange'>Сейчас на сайте находится <b>$online</b> посетителей.<br /></div>
<div class='li_orange'>» Место в ТОПе: <b>$top_place</b><br /></div> ";
echo "<div class='li_orange'><b>Графики:</b></div><div class='li_orange'><b>» График за неделю:</b><br />";
echo "<img src="graphic_7.php?uid=$uid" alt="неделя" /><br /></div>";
echo "<div class='li_orange'><b>» График за 24 часа:</b><br />";
echo "<img src="graphic_24.php?uid=$uid" alt="24 часа" /></div></div>";
$time=date("H");
if ($time >=23) {
echo "<div class='hefo'>Смотреть ТОП с начала<br />
Смотреть ТОП с позиции сайта</div>";
}
else {
echo "<div class='hefo'>- <a href="./">ТОП с начала</a></div>";
echo "<div class='hefo'>- <a href="24.php?uid=$uid">Статистика IP-UA</a></div>";
echo "<div class='hefo'>- <a href="?p=$page">ТОП с позиции сайта</a></div>";
echo "<div class='hefo'>- <a href="registration.php">Регистрация</a></div>";
echo "<div class='hefo'>- <a href="admin.php">Панель управления</a></div>";
echo "<div class='hefo'>- <a href='top.php'>Почему мы лучшие?</a></div>";
echo "<div class='hefo'>- <a href="primer.php">Пример счётчиков</a></div>";
}
break;
default:
echo'
<div class="cent">
Мобильный рейтинг сайтов!<br />
Cтатистика участников ТОПа сайтов<br />
</div>';
$today = date("Ymd", time()+3600);
$start=$count_top*($page-1);
$end=$count_top;
$result=mysql_query("SELECT count(uid) FROM weeks WHERE host > 0 and date=$today");
$cntData=mysql_fetch_row($result);
$count_users=$cntData[0];
$result=mysql_query("SELECT DISTINCT uid,count,host FROM weeks WHERE host > 0 and date=$today ORDER BY host DESC LIMIT $start,$end");
$count_users_on_page = mysql_num_rows($result);
$r=mysql_query("SELECT * FROM users");
echo "<div class='hefo'>Участвуют <b>$count_users</b> из <b>".mysql_num_rows($r)."</b></div>";
echo "<div class='hefo'>Места с <b>".($start+1)."</b> по <b>".($start+$count_top)."</b></div>";
for($i = 0;$i < $count_users_on_page;$i++)
{
$row = mysql_fetch_array($result);
$uid = $row['uid'];
$hits = $row['count'];
$hosts = $row['host'];
$user_data = mysql_query("SELECT site_name,link,admin,info,date FROM users WHERE uid=$uid");
$user_data_row = mysql_fetch_array($user_data);
$site_name = $user_data_row['site_name'];
$link = $user_data_row['link'];
$admin = $user_data_row['admin'];
$info = $user_data_row['info'];
$date_reg = date("d.m.Y",$user_data_row['date']);
$res_count = mysql_query("SELECT sum(count),sum(host) FROM months WHERE uid=$uid");
$count_row=mysql_fetch_row($res_count);
$all_hits = (int)$count_row[0];
$all_hosts = (int)$count_row[1];
$today = date("Ymd", time()+3600);
$hour = date("H");
$resultt = mysql_query("SELECT sum(count),sum(host) FROM count_24 WHERE date=$today AND uid=$uid");
$roww = mysql_fetch_row($resultt);
$count_today = (int)$roww[0];
$host_today = (int)$roww[1];
echo "<div class='cent'><div class='li_orange'>".(($i+1)+($count_top*($page-1))).". <b><a href="$link">$site_name</a></b> <a href="index.php?uid=$uid">[INFO]</a><br /></div>";
echo "<b>» Описание:</b><br /> $info<br />
";
echo "<b>» Сегодня:</b><br /> Хостов: <b>$host_today</b> | Хитов: <b>$count_today</b><br />";
echo "<b>» Всего:</b><br /> Хостов: <b>$all_hosts</b> | Хитов: <b>$all_hits</b><br />
<b>» Админ:</b> $admin<br />
<b>» Регистрация:</b> $date_reg<br />
</div> ";
}
if ($page>1){
$prev=$page-1;
echo "<div class='hefo'>- <a href='index.php?p=$prev'>Пред.</a></div> ";
}
else echo "<div class='hefo'>Пред.</div>";
if (!($end*$page>=$count_users)){
$next=$page+1;
echo "<div class='hefo'><a href='index.php?p=$next'>След.</a></div>";
}
else echo "<div class='hefo'>След.</div>";
echo " <div class='cent'>
<div class='li_orange'><img src='url.png' alt='' /><a href="http://ruwab.com">НА главную</a><br /></div>";
echo "<div class='li_orange'><img src='url.png' alt='' /><a href="registration.php">Регистрация</a><br /></div>";
echo "<div class='li_orange'><img src='url.png' alt='' /><a href='./rulez.php'>Наши Правила</a><br /></div>";
echo "<div class='li_orange'><img src='url.png' alt='' /><a href="admin.php">Панель управления</a><br /></div>";
echo "<div class='li_orange'><img src='url.png' alt='' /><a href='./top.php'>Почему мы лучшие?</a><br /></div>";
echo "<div class='li_orange'><img src='url.png' alt='' /><a href="primer.php">Пример счётчиков</a></div></div>";
}
include "niz.php";
?>