View file forum/temy.php

File size: 1.65Kb
<?
$gdе="Выбирает тему на форуме";
$title="Форум";

include $_SERVER['DOCUMENT_ROOT']."/template/head.php";

if(empty($_GET['id'])){$idi=$id;} else {$idi=$_GET['id'];}
if($id == $idi)
{
	if(!empty($_GET['mess']))
	{
		mysql_query("DELETE FROM `forum2` WHERE `id` = '$_GET[mess]'");
	}
}
	
	


if($id)
{
	if(!empty($_POST['tem']))
	{
		$data=date("d.m.Y H:i");
		mysql_query("insert into `forum2`(`temy`,`data`,`razd`) values('".check($_POST[tem])."','$data','".check($_GET[razd])."');");
	}

?>
	<h4>Новая тема</h4>
    <form action="temy.php?razd=<?echo $_GET[razd];?>" method="post">
    Название:<br>
    <TEXTAREA NAME="tem" ROWS=2 COLS=></TEXTAREA><br/>
    <input type="submit" value="Добавить">
    </form><br>
<?	
	
}

$m = mysql_query("select * from `forum2` WHERE   razd = '$_GET[razd]' ORDER BY `id` desc");

$counter = mysql_num_rows($m);

if($counter==0)
{
	?><br/><br/>Темы не созданы!<br/><br/><?
}
	
while($mess = mysql_fetch_array($m))
{
	include $_SERVER['DOCUMENT_ROOT']."/template/forum.php";
	echo"<div class=\"a\"><a href=\"http://$sit/forum/text.php?razd=$_GET[razd]&temy=$mess[temy]&page=$page\">$mess[temy]</a> [$mess[data]]";
	$mi = mysql_query("select * from `forum3` WHERE   temy = '$mess[temy]' ORDER BY `id` desc limit 1");
	while($mes = mysql_fetch_array($mi))
	{
		echo"<br>Последнее добавление: [$mes[data]]<br>$mes[log]<br>";
	}
	if($id == $idi)
	{
		echo"<a href=\"temy.php?mess=$mess[id]&razd=$_GET[razd]\"><font color='#00ffff'>[</font>удалить<font color='#00ffff'>]</font></a>";
	}
	?></div><?
}

require  $_SERVER['DOCUMENT_ROOT']."/template/foot.php";
    
?>