Файл: __system/pages/index.php
Строк: 48
<?
DEFINE('TITLE' , 'TOP 100'); # фиксируем титул
head();
if(!isset($_GET['id']))
{ $_GET['id'] = '';
}
$sites = $db -> query
("
SELECT * FROM site,site_statistic WHERE site.status = '1' and site.id = site_statistic.siteID
and site_statistic.date = '".date("Y-m-d",time())."' and `host` > '0' ORDER BY site_statistic.host DESC
");
if(!isset($_GET['pages']))
{
$_GET['pages'] = 1;
}
$num = 10;
$pages = $_GET['pages'];
$posts = $sites -> rowCount();
$total = filtration::int(($posts - 1) / $num) + 1;
$pages = filtration::int($pages);
if(empty($pages) or $pages < 0) $pages = 1;
if($pages > $total) $pages = $total;
$start = $pages * $num - $num;
$site = $db -> query
("
SELECT * FROM site,site_statistic WHERE site.status = '1' and site.id = site_statistic.siteID
and site_statistic.date = '".date("Y-m-d",time())."' and `host` > '0' ORDER BY site_statistic.host DESC LIMIT $start, $num
");
$siteRand = $db -> query
("
SELECT * FROM site,site_statistic WHERE site.status = '1' and site.id = site_statistic.siteID
and site.category != 4
and site_statistic.date = '".date("Y-m-d",time())."' and `host` > '0' ORDER BY RAND() LIMIT 0
");
if($siteRand -> rowCount() > 0)
{
while($sR = $siteRand -> fetch(PDO::FETCH_ASSOC))
{
echo '<div class="list"><table id="sites_list"><tbody><span class=font-weight: 0;>';
echo '<img src="http://www.google.com/s2/favicons?domain='.$sR['url'].'" alt="/faviвcons.png" />
'.url('/out/'.$sR['id'].'/',''.$sR['about'].'','','_blanc').'';
echo '</td></tr></tbody></table></div></div></div></div>';
}
}
if($site -> rowCount() > 0)
{
$start_limit = $start + 1;
while($s = $site -> fetch(PDO::FETCH_ASSOC))
{
if($_GET['id'] == $s['id'])
{
$siteUrl = '<b>'.$s['url'].'</b>';
}
else
{
$siteUrl = $s['url'];
}
echo '<div class=list><table id="sites_list"><tbody><tr><td class="tplace">'.$start_limit.'</a></span></td><td><span class=font-weight: 5;>';
echo '<img src="http://www.google.com/s2/favicons?domain='.$s['url'].'" alt="/fivicons.png" />
'.url('/out/'.$s['id'].'/',''.$siteUrl.'','','_blanc').'<span class=font-weight: 700;>
['.url('/siteStatistics/'.$s['id'].'/',''.$s['host'].'/'.$s['hits'].'','','').']</a>
<a href="/siteStatistics/'.$s['id'].'/"><img src=/desing/img/stat.gif></a>';
echo '<br />'.$s['about'].'<br /></td></tr></tbody></table></div></div></div></div>';
$start_limit++;
}
pagination($posts,$num,$total,$pages,'/');
}
else
{
echo '<div class="main">Сайтов участвующих в ТОП 100 нет.</div>';
}
foot();
?>