View file waplend/forum/forum.php

File size: 2.34Kb
<?php 
	$str = $_GET["str"];
	
include ("../head.php");
include ("../tools.php");
 echo "<div class='contur_rek'>
<div class='header_rek'><div style='text-align:center'><big><b>Разделы</b></big></div></div></div>";
	$forum=hacker($_GET["forum"]);
	$forum=htmlspecialchars(stripslashes(trim($forum)));
    $user=hacker(htmlspecialchars(stripslashes(trim($user))));
    $tema=hacker($_GET["tema"]);
    $tema=htmlspecialchars(stripslashes(trim($tema)));

    
  $news = mysql_query("select * from `forum` where type='forum' and idforum='".$forum."';");
  $massivnews = mysql_fetch_array($news);
  $nme = mysql_num_rows($news);
    if ($nme!=1){
    $forum="0";
    $tema="0";    }
    else 
    {	
        
if (!empty($_SESSION['login']))
{echo "<div><img src='add.png' border='0'/> <a href='newtem.php?forum=".$forum."'>Новая тема</a></div>
";}

$q = mysql_query("select * from `forum` where type='tema' and idforum='".$forum."' and zavis='0' order by time desc;");
      $page=hacker($_GET['page']);
      if ($page<=0)
      {$page=1;}
$count = mysql_num_rows($q);
while($arr = mysql_fetch_array($q))
 {
	if ($i<=$page*$kmess & $i>=($page-1)*$kmess)
	{
	$count1 = mysql_query("select * from `forum` where `type`='mess' and `idforum`='".$forum."' and `idtema`='".$arr['idtema']."';");
	$cnt = mysql_num_rows($count1);
	echo "<div class='contur'><div class='header'><img src='users.png' border='0'/> <a href='tema.php?forum=".$forum."&amp;tema=".$arr['idtema']."'>".$arr['text']." ($cnt)</a><br/></div>";
	$last=ceil($cnt/10);

	$count1=0;
	if ($last>=2)
	{
	echo"последняя страница:<a href='tema.php?forum=".$forum."&amp;tema=".$arr['idtema']."&amp;page=".$last."'>".$last."</a>";
	}
	$last=1;
	echo"</div>";
	}
	++$i;
}
echo "<div>";
if ($count>$kmess )
	{
		if ($page<ceil($count/$kolimages))
		{
	$next=$page+1;
	print "<a href='?forum=$forum&amp;tema=$tema&amp;page=".$next."'>Далее</a> ";
		}
	}
	$prev=$page-1;
	if ($prev!=0)
	{print "<a href='?forum=".$forum."&amp;tema=".$tema."&amp;page=".$prev."'>Назад</a>";}
echo "</div>";

if (!empty($_SESSION['login']))
{echo "<div><img src='add.png' border='0'/>  <a href='newtem.php?forum=".$forum."' >Новая тема</a></div>";}
	}
	echo "<div>&#8594; <a href='./' >Разделы</a></div>"; 
require ("../foot.php"); 
	?>