п»ї<?php
//=============================
#Version WapuS_ToP_final
#Script By: Black1992
#Email: skyangel15@inbox.lv
#Icq: 414454754
#Url: http://WaPuS.pp.Ru
//=============================
include("config.php");
include("inc/config.inc.php");
include("inc/functions.inc.php");
ini_set ('session.use_cookies', 0);
ini_set ('session.use_trans_sid', 1);
session_name('sid');
connect_to_db();
$title=DEFAUL_PAGE_TITLE;
include_once 'head.php';
//ТОП всех участников
$today = date("Ymd");
$result = mysql_query("SELECT count(`uid`) FROM `weeks` WHERE `host` > 0 and `date`=$today");
$cntData = mysql_fetch_row($result);
$count_users = $cntData[0];
$max_page = ceil ($count_users / $count_top);
$page = ($page > $max_page) ? (($max_page == 0)? $page : $max_page) : $page;
$start = $count_top*($page-1);
$end = $count_top;
if ($the =='wap') {
echo" <div class=main><a href='razdels.php'>CategorysЏ</a> | TOP100 <b>($count_users)</b><br/></div>"; }
else
{
$count_top = "20";
echo'
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td bgcolor="#d4d5d5">
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr bgcolor="#e6e6e6">
<td rowspan="2" align="center" style="color:#fffcf2; background: url(\'/template/html/art/top_title.png\') top repeat-x #000000; font-size: 14px; text-shadow: 1px 1px 2px #000;"> # </td>
<td rowspan="2" style="color:#fffcf2; background: url(\'/template/html/art/top_title.png\') top repeat-x #000000; font-size: 14px; text-shadow: 1px 1px 2px #000;" width="100%" align="center">';
echo"Wapus Top 100</b></td>";
echo'<td colspan="3" align="center" style="color:#fffcf2; background: url(\'/template/html/art/top_title.png\') top repeat-x #000000; font-size: 14px; text-shadow: 1px 1px 2px #000;">Live Stats</td>
</tr>
<tr bgcolor="#89D363" align="center">
<td style="color:#fffcf2; background: url(\'/template/html/art/top_title.png\') bottom repeat-x #000000; font-size: 14px; text-shadow: 1px 1px 2px #000;">hosts</td>
<td style="color:#fffcf2; background: url(\'/template/html/art/top_title.png\') bottom repeat-x #000000; font-size: 14px; text-shadow: 1px 1px 2px #000;">hits</td>
<td style="color:#fffcf2; background: url(\'/template/html/art/top_title.png\') bottom repeat-x #000000; font-size: 14px; text-shadow: 1px 1px 2px #000;">?</td>
</tr>';
}
//Последняя новость
if ($the =='wap') {
$a = mysql_query("SELECT * FROM `news` WHERE (`stat`=1 or `stat`=2) ORDER BY `id` DESC LIMIT 1");
while($site = mysql_fetch_array($a))
{
$id_news=$site[id];
echo "<font color=\"black\"><div class=news><img src=/img/rss.gif alt=* /><news:</b> ".$site[date]."</div><div class=rek2></font> <font color=\"black\"> ".$site[head]."</font> <br />".$site[body];
//Листинг для счетчика комментов
list($c)=mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM news_comm WHERE `id_news`='$site[id]' "));
//Вывод меню
echo "<br/><div class=kom><a href=\"news.php?uid=&p0&act=1\">News ($c)</a></div></div>";
}
}
// проверка ввода page
if (empty($_GET['p']))
{
$page = 1;
}
elseif ($_GET['p']<1)
{
$page = 1;
}
else
{
$page=htmlspecialchars($_GET['p']);
}
//проверка ввода id
if (!empty($_GET['uid']))
{
$uid=(int)$_GET['uid'];
// проверка существования учетной записи
$result = mysql_query("SELECT site_name,link,admin,info FROM users WHERE uid=$uid");
$row=mysql_fetch_array($result);
if (!empty($row))
{
//пришло
$week_day = date("w");
$today = date("Ymd");
// подсчет
$result = mysql_query("SELECT `in` FROM `weeks` WHERE `date`=$today AND `uid`=$uid LIMIT 1");
$row=mysql_fetch_array($result);
if (empty($row))
{
$dayNext =$week_day + 7;
if ($dayNext > 7)
{
$dayNext-=7;
}
$cntDay=8-$dayNext;
$nextMonday=date("Ymd",mktime(0,0,0,date("m"),date("d")+$cntDay));
@mysql_query("INSERT INTO `weeks` VALUES ('',$uid,$nextMonday,$today,$week_day,0,0,0,0)");
$in_count = 0;
}
else
{
$in_count = $row['in'];
}
$in_count++;
// сохранение
@mysql_query("UPDATE `weeks` SET `in`=$in_count WHERE `date`=$today AND `uid`=$uid LIMIT 1");
$today = date("Ymd");
$hour = date("H");
// за сегодня
$result=mysql_query("SELECT `host` FROM `weeks` WHERE `uid`=$uid AND `date`=$today LIMIT 1;");
$row = mysql_fetch_array($result);
$host_today = $row['host'];
//Место в топе
$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);
if ($page <= 0) $page = 1;
}
}
//ТОП всех участников
$today = date("Ymd");
//получаем кол во участников
$result = mysql_query("SELECT count(`uid`) FROM `weeks` WHERE `host` > 0 and `date`=$today");
$cntData = mysql_fetch_row($result);
$count_users = $cntData[0];
$max_page = ceil ($count_users / $count_top);
$page = ($page > $max_page) ? (($max_page == 0)? $page : $max_page) : $page;
$start = $count_top*($page-1);
$end = $count_top;
// получаем uid участников
$result=mysql_query("SELECT DISTINCT `uid`,`count`,`host`,`in`,`out` FROM weeks WHERE host > 0 and date=$today ORDER BY host DESC LIMIT $start,$end");
$count_users_on_page = mysql_num_rows($result);
if ($count_users_on_page==0)
{
echo "<div class=rek1><font color='red'>Сегодня активных сайтов не было!</font></div>";
}
else
{
// вывод инфы
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,info FROM users WHERE uid=$uid");
$user_data_row = mysql_fetch_array($user_data);
$site_name = htmlspecialchars($user_data_row['site_name']);
$link = htmlspecialchars($user_data_row['link']);
$info = htmlspecialchars($user_data_row['info']);
//Всего
$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];
//подсчитываем онлайн посетителей
$res_count = mysql_query("SELECT count(ip) FROM online_ip WHERE uid=$uid");
$count_row=mysql_fetch_row($res_count);
$online=(int)$count_row[0];
//оценка
$q=@mysql_query("SELECT * FROM `rat` WHERE `uid`='$uid'");
if($r=@mysql_fetch_assoc($q)){
$rat=round($r['rt'],1);
$allrat=$r['allrt'];
}else{
$rat=0;
$allrat=0;}
//комментарии
$komms=@mysql_query("SELECT `komm` FROM `komms` WHERE `uid`=$uid");
$user_komms =(int)@mysql_num_rows($komms);
//Пришло\Ушло
$in_count = (int)$row['in'];
$out_count = (int)$row['out'];
//Определяем дату регистрации и категорию
$mod_data = mysql_query("SELECT registration,razdel FROM users WHERE uid=$uid");
$mod_row=mysql_fetch_array($mod_data);
$registration = $mod_row['registration'];
$kategory = $mod_row['razdel'];
$reg_date = date("d.m.y", $registration);
$kategory_mass = array(
1=>Entertainment, 2=>Hobbies, 3=>Знакомства, 4=>Для_взрослых, 5=>Халява,
6=>Магазины_услуги, 7=>Музыка, 8=>Общение, 9=>Развлечения, 10=>РЎРњР?_Рё_политика,
11=>Спорт, 12=>Прочие);
$kategory = $kategory_mass[$kategory];
switch (($i+1)+($count_top*($page-1))) {
case 1:
$place_img='<img src="1place.png">';
break;
case 2:
$place_img='<img src="2place.png">';
break;
case 3:
$place_img='<img src="3place.png">';
break;
default:
$place_img='';
break;
}
//Выводим активные сайты
if ($the =='wap') {
echo "<div class=main>".(($i+1)+($count_top*($page-1))).". {$place_img} <b><a class=bb href=\"outtop.php?uid=$uid\"> $site_name</a></b>$b1[$c]<br/>";
echo "$info <br/>";
echo "Host & HitsЏ: <b>[$hosts/$hits]</b><br/>";
echo"<a href=\"stat.php?uid=$uid\">Statistics</a><br/>";
//echo "hits in hits out: <b>($in_count/$out_count)</b><br/>";
//echo "<b>all host all hits: </b> all hosts‹: $All_hosts | All hits: $all_hits<br />";
//echo "Online: ";
//echo "<a href=\"online_tel.php?uid=$uid\">$online</a> <br/>";
//echo "Rating: <a href=\"rating.php?uid=$uid\">($rat/$allrat)</a><br/>";
//echo "Comments: <a href=\"komms.php?uid=$uid\">($user_komms)</a><br/>";
//echo "CategoryЏ: <b><u>$Category</u></b><br/>";
echo "</div>"; }
else{
echo'<tr bgcolor="#e6e6e6">
<td style="color:#333333; text-align: center;">';
echo "".(($i+1)+($count_top*($page-1))).".</td>
<td> {$place_img} <b><a class=bb href=\"outtop.php?uid=$uid\"> $site_name</a></b>$b1[$c]<br/>";
echo "$info <br/>";
echo "</td>
<td align=right nowrap style=color:#333333; text-align: center;>$hosts</td><td align=right nowrap style=color:#333333; text-align: center;>$hits";
echo"</td>
<td align=center style=color:#333333; text-align: center;><a href=stat.php?uid=$uid><img src=pubst.gif border=0 width=18 height=17 alt=></a></td>
</tr>";
}
}
//постраничная навигация
if ($the =='web') {
echo'</table></div>'; }
echo "<div class=\"rek2\" align=\"center\">";
if ($page>1)
echo "<a href=\"index.php?p=".($page-1)."\">Prev.</a> | ";
echo "Page.<b>$page</b> of· ".$max_page;
if ($max_page-$page>0)
echo " | <a href=\"index.php?p=".($page+1)."\">Next.</a>";
echo "<br>";
$in=-3;
$out=3;
if ($page!=1)
{
echo " <a href=\"index.php?p=1\">1</a> ";
}
else
{
echo " <b>[1]</b> ";
}
for ($ot=$in; $ot<=$out; $ot++)
{
$t_str=$page+$ot;
if ($t_str>1 && $t_str<$max_page)
{
if ($in==$ot && $t_str>2)
{
echo " ... ";
}
if ($ot!=0)
{
echo " <a href=\"index.php?p=$t_str\">$t_str</a> ";
}
else
{
echo " <b>[$t_str]</b> ";
}
if ($ot==$out && $t_str<$max_page-1)
{
echo " ... ";
}
}
}
if ($page!=$max_page)
{
echo "<a href=\"index.php?p=$max_page\">$max_page</a>";
}
elseif ($max_page>1)
{
echo " <b>[$max_page]</b>";
}
echo "</div>";
}
if ($the =='wap') {
include"menu.php";
}
include "foot_code.php";
?> <a href="http://wapus.site40.net/?uid=1"><img src="http://wapus.site40.net/count.php?uid=1" alt="WapuS_ToP"/></a><a href="http://xtube.fav.cc/?uid=22"><img src="http://xtube.fav.cc/count.php?uid=22" alt="xtube.fav.cc"/></a><a href="http://pulselive.ru/go/30"><img src="http://pulselive.ru/image/30" alt="pulselive.ru"/></a> <a href="http://master-land.net">WapMasters Forum</a>