View file index.php

File size: 4.16Kb
<?php

session_start();

define('NTOP', 1);

$title = 'waptop';

require_once ('system/connect.php');

require_once ('system/core.php');

require_once ('system/function.php');

require_once ('m/head.php');


$posl_news = mysql_query("SELECT * FROM `".$prefix."news` ORDER BY `time` DESC LIMIT ".$set['news_index']."");
if(mysql_num_rows($posl_news) > 0)
	{
		while($row = mysql_fetch_array($posl_news))
			{
			$rat_plus = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."news_rep` WHERE `id_news` = '".$row['id']."'")); 
            $proverka = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."news_rep` WHERE `ip` = '".$ip."' AND `id_news` = '".$row['id']."'"));
			
				$page = ceil(mysql_result(mysql_query("SELECT COUNT(*) FROM `".$prefix."news` WHERE `id` = '".$row['id']."'"), 0) / $page_news);
				$comm_count = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."news_comments` WHERE `id_news`='".$row['id']."'"));
				echo '<div class="topni">';
				echo '<a href="http://'.$set['home'].'/m/news/'.$page.'"><font color="#696969"><b><span class="o">'.$row['name'].'</span></b></font></a> ['.data($row['time']).']<br/>';
				echo '</div>';
				echo '<div class="main">';
				if(mb_strlen($row['text']) > 100)
				{
					$text = mb_substr($row['text'],0,100);
					echo ''.$text.'.... <a href="http://'.$set['home'].'/m/news/'.$page.'">News</a><hr>'; 
				}
				else
				{
					echo ''.$row['text'].'<hr>'; 
				}
				
						echo '<span class = "gray" style="float:right"><a style="margin-right: 9px"><a href="http://'.$set['home'].'/m/news/comments/'.$row['id'].'">Comments</a> ['.$comm_count.']</span>';
				
			
				
if($proverka == 0){
echo ' <a class="nr" href="http://'.$set['home'].'/m/news/like1/'.$row['id'].'">Like News: +<b>'.$rat_plus.'</b></a></div>';
} else { 
echo ' <a class="nr" href="http://'.$set['home'].'/m/news/like0/'.$row['id'].'">Like News: +<b>'.$rat_plus.'</b></a></div>';}		
				echo '</div>';
				echo '</div>';
			}

}

$vse_sait = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `hosts` > '0'"));


echo '<div id="categories"><b>Top: '.$vse_sait.'</b></div>';

echo '<div class="topni"><center>[<a href="http://'.$set['home'].'/m/search"><b>Search</b></a> | <a href="http://'.$set['home'].'/servise"><b>Service</b></a>]</center></div>';


$all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0'"));

if($all != 0)

{

$total=intval(($all-1)/$page_top)+1;

$page=abs(intval($_GET['page']));

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' ORDER BY `hosts` DESC LIMIT ".$start.",".$page_top."");

while($row = mysql_fetch_array($top))

{

$start++;


echo '<div class="topni"><span class="o">'.$start.'</span> <img src="http://www.google.com/s2/favicons?domain='.$row['url'].'"/> <a href="http://'.$set['home'].'/out/'.$row['id'].'"> '.$row['name'].'</a> ['.$row['hosts'].'/'.$row['hits'].'] <a href="http://'.$set['home'].'/stats/'.$row['id'].'"><img src="/img/index/s.gif" alt="?"></a><br/>';

if(mb_strlen($row['about']) > 100)

{

$text = substr($row['about'],0,100);

echo ''.$text.'...<br/>';

}

else

{

echo ''.$row['about'].'<br/></font></b></u>';

}

echo '</div>';

echo '<div class="topni">in: <b>'.$row['in'].'</b> | out: <b>'.$row['out'].'</b>]</div>';



}

///////////////////////////////
        $new_sait = mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' ORDER BY `id` DESC LIMIT 1");
		$new_sait_check = mysql_num_rows($new_sait);
		$nsait = mysql_fetch_array($new_sait);
		$new = ($new_sait_check > 0)  ? '<a href = "http://'.$set['home'].'/stats/'.$nsait['id'].'">'.$nsait['name'].'</a>' : 'Нет';
	

echo '<div class="topni">Newest site: '.$new.'</div>';
/////////////////////////////////////////////////////////////

navigation($all,$page_top,$page,'/',$total);

}

else

{

echo '<div class="topni">';

echo 'NO active sites!!Add your sites!!';

echo '</div>';

}





unset($_SESSION['id']);


require_once ('m/foot.php');


?>