View file news/index.php

File size: 1.36Kb
<?php
include ("../tools.php");
require("../head.php");
echo "<div class='contur_rek'>
<div class='header_rek'><p align='center'><big><b>Новости сайта</b></big></p></div></div>";

$i=0;
$messages = mysql_query("select * from `news` where type='news' order by id desc ;");
  $page=hacker($_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)
	{

   $messagescomm = mysql_query("select * from `news` where `type`='komm' and `idnews`='".$massiv['id']."';");
   	   	   	   $countcomm = mysql_num_rows($messagescomm);
   echo "<div class='contur'><div class='header'><font color='red'>&#187; </font>".$massiv['zagol']." (".date("d.m.y (H:i)", $massiv['time']).")<br/>".str_replace($sm1,$sm2,$massiv['full'])."<br/> <a href='fullnews.php?id=".$massiv['id']."'>Мнений [$countcomm]</a></div></div>";


    }
    ++$i;
   }
if ($count>10)
	{
	$next=$page+1;
	print "<div><a href='news.php?page=".$next."'>Далее</a></div>";
	}
	$prev=$page-1;
	if ($prev!=0)
	{print "<div><a href='news.php?page=".$prev."'>Назад</a></div>";}
echo "<div class='contur'><div class='header'>[новостей: ".$count."]<br/>";
echo "<a href='../index.php'>&#8594; На главную</a></div></div>";
require ('../foot.php');
?>