View file forum/forum/edit.php

File size: 3.31Kb
<?php
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";
include_once"../template/isset.php";
include_once"../template/db.php";
include_once"fnc.php";

if ($provpar == md5($_SESSION['par']) && $provlog == $_SESSION['log']) {
if ($dostup == 101 || $dostup == 102 || $dostup == 103 || $dostup == 105) {
$id = (int)$_GET['id'];

if ($id) {
$check = mysql_fetch_array(mysql_query("SELECT * FROM `posts` WHERE `id` = '".$id."'"));
if (trim($check)) {
//////////////////////////////////////////////////// Выводим данные //////////////////////////////////////////////////////
$posts = mysql_query("SELECT * FROM `posts` WHERE `id` = '".$id."'");
$post = mysql_fetch_array($posts);
$thms = mysql_query("SELECT * FROM `theme` WHERE `id` = '".$post['theme']."'");
$thm = mysql_fetch_array($thms);
//////////////////////////////////////////////////// Записываем данные ///////////////////////////////////////////////////
if ($_POST['msg']) {
$msg = checkus($_POST['msg']);
mysql_query("UPDATE `posts` SET `msg`='".$msg."' WHERE `id` = '$id'");
mysql_query("UPDATE `posts` SET `edit`=edit+1 WHERE `id` = '$id'");
mysql_query("UPDATE `posts` SET `edit_time`='".$sitetime."' WHERE `id` = '$id'");
mysql_query("UPDATE `posts` SET `edit_author`='".$log."' WHERE `id` = '$id'");
//////////////////////////////////////////////////// Перенаправляем в тему ///////////////////////////////////////////////
$filek = mysql_result(mysql_query("SELECT COUNT(*) FROM `posts` WHERE `theme` = '$id'"), 0);
if ($filek != '0') {$filek = $filek-1;} 
$start = floor($filek / $config_forumpost) * $config_forumpost;
header ("Location: ".$config_home."/forum/posts/".$thm['id']."/".$start."");exit;} 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

echo '<div class="b">Тема: '.$thm['name'].'</div>';
echo "<div class=form>\n";
echo "<form action='".$config_home."/forum/edit/".$id."' method='post'>\n";
echo "Сообщение:<br><textarea cols='25' rows='3' name='msg'>" . $post['msg'] . "</textarea><br>\n";
echo "<input type='submit' name='add' value='Изменить'></form>\n</div>\n";
echo "<div>\n";

$filek = mysql_result(mysql_query("SELECT COUNT(*) FROM `posts` WHERE `theme` = '" . $id . "'"), 0);
if ($filek != '0') { $filek = $filek-1;}
$start = floor($filek / $config_forumpost) * $config_forumpost;
echo ": <a href='".$config_home."/forum/posts/".$thm['id']."/".$start."'>В тему</a><br>";
echo ":: <a href='index.php?" . SID . "'>В форум</a><br>";
echo "::: <a href='../index.php?" . SID . "'>На главную</a>";
echo "</div>\n";
} else {echo "<br> <img src='../images/img/close.gif' alt=''> Ошибка! Такого сообщения не существует!<br>\n";}} 
} else {header ("Location: ../index.php?isset=404&".SID);} 
} else {header ("Location: ../index.php?isset=404&".SID);} 

include_once"../themes/$config_themes/foot.php";

?>