View file forum/index.php

File size: 1.35Kb
<?
$gde="На главной форума";
$title="Форум";
include $_SERVER['DOCUMENT_ROOT']."/template/head.php";
if(empty($_GET['id'])){$idi=$id;} else {$idi=$_GET['id'];}
if($id == $idi)
{
	if(isset($_GET['mess']))
	{
		mysql_query("DELETE FROM `forum1` WHERE `id` = '$_GET[mess]'");
	}

	if(isset($_POST['razdel']))
	{
		$data=date("d.m.Y H:i");
		mysql_query("insert into `forum1`(`idi`,`razd`,`data`) values('$id','".check($_POST[razdel])."','$data');");
	}


?>
	<h4>Новое сообщество</h4>
    <form action="index.php" method="post">
    Введите название:<br/>
    <TEXTAREA NAME="razdel" ROWS=2 COLS=></TEXTAREA><br/>
    <input type="submit" value="Добавить">
    </form><br>
	
	
	
<?


}

$m = mysql_query("select * from `forum1` where `idi`='$idi' ORDER BY `id` desc");

$counter = mysql_num_rows($m);

if($counter==0)
{
	?><br/><br/>Сообщества не созданы!<br/><br/><?
}
	
while($mess = mysql_fetch_array($m))
{
	echo"<div class=\"a\"><a href=\"http://$sit/forum/temy.php?razd=$mess[razd]\">$mess[razd]</a> [$mess[data]]";


	if($id == $idi)
	{
		echo" <a href=\"index.php?mess=$mess[id]\"><font color='#00ffff'>[</font>удалить<font color='#00ffff'>]</font></a>";
	}
	?></div><?
}
?>
</td><td valign="top" width="500" align="left">
<?	
require  $_SERVER['DOCUMENT_ROOT']."/template/foot.php";
    
?>