Просмотр файла forum/index.php

Размер файла: 2.96Kb
<?php
include ("../head.php");
include ("../tools.php");
	$forum=hacker($_GET["forum"]);
	$forum=htmlspecialchars(stripslashes(trim($forum)));
    $user=hacker(htmlspecialchars(stripslashes(trim($user))));
    $tema=hacker($_GET["tema"]);
    $tema=htmlspecialchars(stripslashes(trim($tema)));

if (empty($_GET[act]))
{  echo "<div class='contur_rek'>
<div class='header_rek'><p align='center'><big><b>Форум</b></big></p></div></div>";
echo "<div class='contur_t'><div class='header'><img src='doc.png' border='0'/>
<a href='prav.php'>Правила</a>";
echo "<br/><img src='search.png' border='0'/>  <a href='seach.php'>Поиск по форуму</a>";
echo "<br/>Разделы:</div></div>";
$q = mysql_query("select * from `forum` where type='forum' order by position ;");
while($arr = mysql_fetch_array($q)) {

		$count = mysql_query("select * from `forum` where type='tema' and idforum='".$arr['idforum']."';");
	$cnt = mysql_num_rows($count);
		$count = mysql_query("select * from `forum` where type='mess' and idforum='".$arr['idforum']."';");
	$cnt1 = mysql_num_rows($count);
	////////////по последней теме и сообщению
	    $mess = mysql_query("select * from `forum` where type='mess' and `idforum`='".$arr['idforum']."' and `zavis`='0'  order by time desc;");
	   if (mysql_affected_rows()>0)
	    {
	    $array = mysql_fetch_array($mess);
		}
	    $mess1 = mysql_query("select * from `forum` where type='tema' and `idforum`='".$array[idforum]."' and `idtema`='".$array['idtema']."' order by time desc;");

	    if (mysql_affected_rows()>0)
	    {

	    	 if ($array['idforum']>="0" or $array['idtema']>="0")
	    	 {
	    $array1 = mysql_fetch_array($mess1);
	    	 }
	    }

$mess2 = mysql_query("select * from `forum` where type='mess' and `idforum`='".$array1['idforum']."' and `idtema`='".$array1['idtema']."' order by time desc;");
$cn=mysql_num_rows($mess2);
if ($cn>10)
{
	$page=ceil($cn/10);
}
else
{
	$page="1";
}
if (mysql_affected_rows()>0)
	    {
if ($array1['idforum']>="0" or $array1['idtema']>="0")
	    	 {
	    $array2 = mysql_fetch_array($mess2);
}
        }

			////////////по последней теме и сообщению
	echo "<div class='contur'><div class='header'><a href='forum.php?forum=".$arr['idforum']."'>&#8594; ".$arr['text']."</a> [$cnt/$cnt1]</div><div class='header'>Тема:<a href='tema.php?forum=".$array1['idforum']."&amp;tema=".$array1['idtema']."&amp;page=".$page."'>".$array1['text']."</a><br/>Посл. сообщение:".$array2['author']." (";
	if ($array2['time']>0)
	{
	echo date("H:i /d.m.y/",$array2['time']);
	} else {echo "нет сообщений";}
	echo ")</div></div>";
	$array['idforum']="";
	$array['idtema']="";
	$array1['idforum']="";
	$array1['idtema']="";
	$array1['text']="";
	$array2['author']="";
	$array2['time']="";
}
echo "<div class='header'><a href='../index.php'>&#8594; На главную</a></div>";
}

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