View file lib/main.php

File size: 3.28Kb
<?php

if (! defined ( 'CATALOGDEEP' )) {
	die ( "Hacking attempt!" );
}

include "head.php";
main_news();
$id = abs((int)$_SERVER['QUERY_STRING']);
if(!empty($id)){
	$act = "list";
}else{
	$act = "def";
	}
switch($act){
	case 'def':
	echo "<div class='title'>Категории</div>";
	$sql = mysql_query("SELECT * FROM `cat_category` ORDER BY `position`");
	$i = 1;
	while($row = mysql_fetch_assoc($sql)){
		$int = $i/ 2;
if(is_integer($int)){
$div = '<div class="menu">';
}else{
$div = '<div class="menu">';
}	
echo $div;
$sqlq = mysql_query("SELECT `category` FROM `cat_users` WHERE `category` = '".$row['id']."' AND `status` != 'mod' AND `status` != 'ban' AND `in` > 0");
$user_all = mysql_query("SELECT `category` FROM `cat_users` WHERE `category` = '".$row['id']."' AND `status` != 'ban'");
$user_all = mysql_num_rows($user_all); 
$users_act = mysql_num_rows($sqlq);

		echo "<img src='style/images/go.gif' alt='' /><a href='index.php?".$row['id']."'>".$row['name']."</a>[".$users_act."/".$user_all."]<br/>";
		echo "&#187;<span class='menu_s'>".$row['about']."</span><br/>";
		$i++;
		echo "</div>";
		}
		
////////Категория заблокированных////////////
$bans = mysql_num_rows(mysql_query("SELECT `category` FROM `cat_users` WHERE `status` = 'ban'"));
echo "<div class='menu'>";
echo "<img src='style/images/go.gif' alt='' /><a href='/bans/'>!Заблокированные</a>[".$bans."]<br/>";
echo "&#187;<span class='menu_s'>Список заблокированных сайтов</span><br/>";
echo "</div>";

rand_site(); ///Вывод нового сайта
		
	break;
	case 'list':
	$q=mysql_query(" SELECT count(*) FROM `cat_users`"); 
$all=mysql_result($q,0,0);
  
    $pnumber=10; 
		$n=new Navigator($all,$pnumber); 
		$q=mysql_query("SELECT * FROM `cat_users` LIMIT {$n->start()},$pnumber "); 
		$sql = mysql_query("SELECT * FROM `cat_users` WHERE `category` = '".$id."' AND `in` > 0 AND `status` != 'mod' AND `status` != 'off' AND `status` != 'ban' ORDER BY `in` DESC");
			$kat = mysql_query("SELECT * FROM `cat_category` WHERE `id` = '".$id."'");
			$katr = mysql_fetch_assoc($kat);
			echo "<div class='title'>Категория - ".$katr['name']."</div>";
	if(mysql_num_rows($sql) > 0){
		$i = 1;
				while($row = mysql_fetch_assoc($sql)){
					$int = $i/ 2;
if(is_integer($int)){
$div = '<div class="menu">';
}else{
$div = '<div class="menu">';
}	
echo $div;
			echo $i.".<a href='/out/".$row['id']."'>".$row['name']."</a> <a href='/stat/".$row['id']."'>[?]</a><br/>";
			echo "&#187;<span class='menu_s'>".$row['about']."</span><br/>";
			echo "<div class='dote'>На сайт:".$row['out']."<br/>";
			echo "В каталог:".$row['in']."</div>";
						if(sys_komsites != 1){
	
					$komsites = mysql_query("SELECT * FROM `cat_komsites` WHERE `id_site` = '".$row['id']."'");
			$komsites = mysql_num_rows($komsites);
			echo "&#187;<a href = '/kom_sites/".$row['id']."'>Комментарии</a>[".$komsites."]<br/>";
			}
			echo "</div>";
			$i++;
			
			}
		}else{
			echo "Сайтов в этой категории нет<br/>";
		}
     
    
    echo $n->navi(); 

	
	break;
}
include "foot.php";
/**********************/
/*Нарушение авторских прав, приследуется темной за углом*/
/*(с) govnokod by DeeP      http://lovap.ru             */
?>