Файл: imstat.ru/index.php
Строк: 66
<?php
define('NTOP', 1);
$title = 'Мобильный рейтинг сайтов';
require_once ('system/connect.php');
require_once ('system/core.php');
require_once ('system/function.php');
require_once ('str/head.php');
if($_COOKIE['version'] == 'web'){
echo '<table class="stata"><tr>
<th class="left0 top0">#</th>
<th class="top0">Сайты из категории Top-100</th>
<th class="top0">Хосты</th>
<th class="top0">Хиты</th>
<th class="top0">В топ</th>
<th class="top0">Из</th>
<th class="right0 top0">?</th></tr>';
$all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '4'"));
if($all != 0){
$total = intval(($all-1)/20)+1;
$page = abs(intval($_GET['page']));
if($id or $id >= 1){
$result = mysql_query("SELECT `hosts` FROM `".$prefix."sait` WHERE `id` = '".$id."' AND `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '4' LIMIT 1;");
$row = mysql_fetch_array($result);
$host_today = $row['hosts'];
$topt = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `category` != '4' AND `hosts`>= '".$host_today."' ORDER BY `hosts` DESC;"));
$page = ceil($topt/20);
}
if(empty($page) OR $page <= 0){
$page = 1;
}
if($page > $total){
$page = $total;
}
$past=intval($all/20);
$start=$page*20-20;
$top = mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '4' ORDER BY `hosts` DESC LIMIT ".$start.",20");
while($row = mysql_fetch_array($top)){
$start++;
echo '<tr class="tr2"><td class="num bold left0">'.$start.'</td>';
if($row['id'] == $id){
echo'<td class="site"><a href="/out.php?id='.$row['id'].'"><font color="red">'.$row['url'].'</font></a>';
} else {
echo'<td class="site"><a href="/out.php?id='.$row['id'].'">'.$row['url'].'</a>';
}
echo'<br><small>'.$row['about'].'</small></td>
<td>'.stats($row['hosts']).'</td>
<td>'.stats($row['hits']).'</td>
<td>'.$row['in'].'</td>
<td>'.$row['out'].'</td>';
if($row['mem'] == 0){echo'<td class="more right0"><a href="/str/infos.php?id='.$row['id'].'"><img src="/images/s.gif" alt="?" style="padding:2px;padding-top:4px;"></a></td></tr>';
}else{echo'<td class="more right0"><img src="/images/d.gif" alt="?" style="padding:2px;padding-top:4px;"></td></tr>';}}
echo'</table>';
navigation($all,20,$page,'index.php?',$total);
} else {
echo '<div class="stat">Сайтов в топе пока нет!</div>';}
}else{
echo'<div class="topik">Top 100 | <a href="/str/cat.php">Категории</a></div>';
$l = mysql_query("SELECT * FROM `".$prefix."rek` WHERE `status` = '1' ORDER BY `id` DESC");
echo '<div class="rek">';
while($rek = mysql_fetch_array($l)){
if(empty($rek['color']))echo '<a href="http://'.$rek['url'].'">'.$rek['name'].'</a><br>'; else echo '<a href="http://'.$rek['url'].'"><font color="'.$rek['color'].'">'.$rek['name'].'</font></a><br>';}
echo'<a href="reklama.php">Свободное место 150р.</a></div>';
$all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '4'"));
if($all != 0){
$total = intval(($all-1)/$page_top)+1;
$page = abs(intval($_GET['page']));
if($id or $id >= 1){
$result = mysql_query("SELECT `hosts` FROM `".$prefix."sait` WHERE `id` = '".$id."' AND `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '4' LIMIT 1;");
$row = mysql_fetch_array($result);
$host_today = $row['hosts'];
$topt = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `category` != '4' AND `hosts`>= '".$host_today."' ORDER BY `hosts` DESC;"));
$page = ceil($topt/$page_top);
}
if(empty($page) OR $page <= 0){
$page = 1;
}
if($page > $total){
$page = $total;
}
$past=intval($all/$page_top);
$start=$page*$page_top-$page_top;
$top = mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '4' ORDER BY `hosts` DESC LIMIT ".$start.",".$page_top."");
while($row = mysql_fetch_array($top)){
if($row['id'] == $id){
$start++;
echo '<div class="topni">'.$start.'. <a href="/out.php?id='.$row['id'].'"><span class="site"><b><font color=red>'.$row['url'].'</font></b></span></a> <small>('.$row['hosts'].'/'.$row['hits'].'';
//echo ($row['hits'] > 999 ? round($row['hits']/1000).'К' : $row['hits']);
if($row['mem'] == 0){
echo')</small> <a href="/str/infos.php?id='.$row['id'].'"><img src="/images/s.gif" alt="?"></a>';}else{echo')</small> <img src="/images/d.gif" alt="*">';}
} else {
$start++;
echo '<div class="topni">'.$start.'. <a href="/out.php?id='.$row['id'].'"><span class="site">'.$row['url'].'</span></a> <small>('.$row['hosts'].'/'.$row['hits'].'';
//echo ($row['hits'] > 999 ? round($row['hits']/1000).'К' : $row['hits']);
if($row['mem'] == 0){
echo')</small> <a href="/str/infos.php?id='.$row['id'].'"><img src="/images/s.gif" alt="?"></a>';}else{echo')</small> <img src="/images/d.gif" alt="*">';}}
echo'<div class="info">'.$row['about'].'</div></div>';
}
echo'<div class="t">За сегодня | <a href="/index2.php">За вчера</a></div>';
navigation($all,$page_top,$page,'index.php?',$total);
} else {
echo '<div class="stat">Сайтов в топе пока нет!</div>';}
echo'<div class="topik">';
if(!$user_data){echo'<a href="/str/enter.php">Войти</a> | <a href="/str/reg.php">Регистрация</a><br>';}else{
echo'<a href="/str/office.php"><b>'.$user_data['login'].'</b></a> | <a href="/str/enter.php?act=exit">Выход</a><br>';}
echo'</div>';
}
require_once ('str/foot.php');
?>