Размер файла: 2.59Kb
<?
$gde="Общается на форуме";
$title="Форум";
include $_SERVER['DOCUMENT_ROOT']."/template/head.php";
if(empty($_GET['id'])){$idi=$id;} else {$idi=$_GET['id'];}
if($id == $idi)
{
if($_GET['action'] == "del")
{
mysql_query("DELETE FROM `forum3` WHERE `id` = '$_GET[mess]'");
}
}
if ($id)
{
?>
<?$text=check($_POST['text']);
if(!empty($text))
{
$data=date("d.m.Y H:i");
mysql_query("insert into `forum3`(`idi`,`text`,`data`,`temy`,`razd`) values('$id','$text','$data','".check($_GET[temy])."','".check($_GET[razd])."');");
}
}
if (empty($_GET['page'])){ $page = 0;}
if ($_GET['page'] < 0){ $page = 0;} else {$page = $_GET['page'];}
$max_mess=30;
$m = mysql_query("select * from `forum3` WHERE `razd`='$_GET[razd]' and `temy`='$_GET[temy]' ORDER BY `id` limit $page ,$max_mess");
$u = mysql_query("select * from `forum3` WHERE `razd`='$_GET[razd]' and `temy`='$_GET[temy]'");
$counter = mysql_num_rows($u);
if($counter==0)
{
?><br/><br/>сообщений нет!<br/><br/><?
}
while($mess = mysql_fetch_array($m))
{
$m1 = mysql_query("select * from `prof` WHERE `id` = '$mess[idi]'");
//include $_SERVER['DOCUMENT_ROOT']."/template/smiles.php";
?>
<div>
<table border="2" cellpaldding="0" cellspacing="0">
<tr height=100>
<td width="100">
<?
while($mess1 = mysql_fetch_array($m1))
{
photo_sten($mess1[foto],$mess[idi]);
echo'<a href="./?id='.$mess[idi].'">'.$mess1[name].' '.$mess1[fam].'</a><br/>'.$mess[data].'<br/>';
if($id == $idi)
{
echo"<a href=\"text.php?razd=$_GET[razd]&temy=$_GET[temy]&action=del&mess=$mess[id]&page=$page\">[удалить]</a>";
}
echo"</td><td width=\"500\" valign=\"top\">";
echo"$mess[text]<br>";
?></td></tr></table></div><br><?
}}
echo 'Всего сообщений '.$counter.'<br/>';
if ($page > 0)
echo '<a href="'.$PHP_SELF.'?razd='.$_GET[razd].'&temy='.$_GET[temy].'&page='.($page - $max_mess).'">«назад</a>';
if ($counter > $page + $max_mess)
echo '<a href="'.$PHP_SELF.'?razd='.$_GET[razd].'&temy='.$_GET[temy].'&page='.($page + $max_mess).'">далее»</a>';
if ($id)
{
$kas=floor($counter/$max_mess)*$max_mess;
?>
<form action="text.php?action=add1&page=<?echo $kas;?>&razd=<?echo $_GET[razd];?>&temy=<?echo $_GET[temy];?>" method="post">
Быстрый ответ:<br/>
<TEXTAREA NAME="text" ROWS=10 COLS=50></TEXTAREA><br/>
<input type="submit" value="Добавить">
</form><br>
<?
}
require $_SERVER['DOCUMENT_ROOT']."/template/foot.php";
?>