Размер файла: 1.86Kb
<?php
include "head.php";
if (! defined ( 'CATALOGDEEP' )) {
die ( "Hacking attempt!" );
}
$id = abs((int)$_GET['id']);
if(!empty($id)){
$act = "list";
}else{
$act = "def";
}
switch($act){
case 'def':
$q=mysql_query(" SELECT count(*) FROM `cat_news`");
$all=mysql_result($q,0,0);
$pnumber=10;
$n=new Navigator($all,$pnumber);
$q=mysql_query("SELECT * FROM `cat_news` LIMIT {$n->start()},$pnumber ");
echo "<div class='title'>Новости</div>";
$sql = mysql_query("SELECT * FROM `cat_news` ORDER BY `id`");
$i = 1;
if(mysql_num_rows($sql)>0){
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 news_status($row['status'])."<a href='/news/".$row['id']."'>".$row['title']."</a>[".$row['date']."]<br/>";
echo mb_substr($row['news'],0,60, "UTF-8")."...<br/>";
echo "»<a href='/news/".$row['id']."'>Подробние...</a>";
$i++;
echo "</div>";
echo $n->navi();
}
}else{
echo "Новостей нет";
}
break;
case 'list':
$sql = mysql_query("SELECT * FROM `cat_news` WHERE `id` = '".$id."'");
if(mysql_num_rows($sql) > 0){
$i = 1;
while($row = mysql_fetch_assoc($sql)){
$int = $i/ 2;
if(is_integer($int)){
$div = '<div class="cat">';
}else{
$div = '<div class="cat2">';
}
echo $div;
echo "<div class='title'>".news_status($row['status'])."".$row['title']."</a>[".$row['date']."]</div>";
echo $row['news'];
echo "</div>";
$i++;
echo "»<a href='/news/'>К новостям</a><br/>";
}
}else{
echo "Новость не найдена!<br/>";
}
break;
}
include "foot.php";
/**********************/
/*Нарушение авторских прав, приследуется темной за углом*/
/*(с) govnokod by DeeP http://lovap.ru */
?>