View file file/news/news.php

File size: 1.62Kb
<?php

Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);

extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);
extract($HTTP_SERVER_VARS);
extract($HTTP_SESSION_VARS);

session_name('SESID');
session_start();
require("../../mysql.php");
require ('../../config.php'); //Подключаем настройки сайта. (config.php)
require ('../../themes/'.$themes.'.php'); //Вставляем скин сайта.
require ("../../ban.php");
echo "<center>Новость</center>";

$i=0;
$messages = mysql_query("select * from `news` where type='news' order by id desc ;");
  $page=hack_to_good($_GET['page']);
      if ($page<=0)
      {$page=1;}
$count = mysql_num_rows($messages);
   while($massiv = mysql_fetch_array($messages))  
   {if ($i<=$page*10 & $i>=($page-1)*10)
	{ 
   echo '<div class="admin">';
   $messagescomm = mysql_query("select * from `news` where type='comm' and idnews='".$massiv['idnews']."';");
   	   	   	   $countcomm = mysql_num_rows($messagescomm);
   echo "<font color='red'>&#187;</font>$massiv[shortnews] <font color='red'>l</font> ".date("d.m.y (H:i)", $massiv['date'])."<br/> $massiv[fullnews]<br/> <a href='".$home."/file/news/kom.php?id=".$massiv[idnews]."'>Комментариев [$countcomm]</a> </div>";
   		   
   
    }
    ++$i;
   }
if ($count>10)
	{
	$next=$page+1;
	print "<br/><a href='news.php?page=".$next."'>Далее</a><br/>";
	}
	$prev=$page-1;
	if ($prev!=0)
	{print "<a href='news.php?page=".$prev."'>Назад</a>";}
echo 'Всего новостей: '.$count.'';

require ('../../foot.php'); 
?>