Файл: backup/plugin/editpost.php
Строк: 30
<?
require_once('../core/start.php');
if(!isset($user['id'])){
header('location:/');
exit;
}
$id = abs(intval($_GET['id']));
$them = core::$dbs->queryFetch("SELECT * FROM `forum_theme` where `id` = ? limit 1",array($id));
if($them['type']==1 or empty($them['name'])){
header('location:/');
exit();
}
$raz = $them['id_r'];
$praz = $them['id_pr'];
$uid = abs(intval($_GET['uid']));
$post = core::$dbs->queryFetch("SELECT * FROM `forum_msg` where `id` = ? limit 1",array($uid));
if(empty($post['id'])){
header('location:/');
exit();
}
$ank = core::$dbs->queryFetch("SELECT * FROM `users` WHERE `id` = ? LIMIT 1",array($post['user_id']));
if(empty($ank['id'])){
header('location:/');
exit();
}
if(($user_id!=$post['user_id'])&&($level<1)&&(func::user_inf($level<$post[user_id],'level'))){
header('location:/plugin/topic/'.$id);
exit();
}
$title = 'Изменить сообщение';
require_once(root.'core/header.php');
echo '<div class="wizart">Изменить сообщение</div>';
func::head_menu();
if(isset($_POST['submit'])){
$msg = func::check($_POST['msg']);
if(empty($msg)){
$err ='Введите текст сообщения!';}
if(strlen($msg)<3){
$err .='Слишком короткое сообщение. Минимум 3 символа.';}
if(!isset($err)){
core::$dbs->query("UPDATE `forum_msg` SET
`text` = ?, `who_edit` = ?, `time_edit` = ?, `kol` = `kol` + ? WHERE `id` = ? LIMIT 1",array($msg,$user_id,time(),1,$post['id']));
header('location: /plugin/topic/'.$them['id']);
exit();
} else {
echo '<div class="err">'.$err.'</div>';
}
}
echo '<form method="POST" action="/plugin/editpost/'.$id.'/'.$uid.'">Сообщение:<br/><textarea name="msg">'.$post['text'].'</textarea><br /><input type="submit" name="submit" value="Отправить"></form></div>';
func::footer_menu();
require_once(root.'core/footer.php');
?>