File size: 1.47Kb
<?php
if ($u['id']) {
$comm_r = mysql_query("SELECT `id`, `id_".$type."`, `id_user`, `text`, `time` FROM `".$type."_comm` WHERE `id` = '$id'");
$comm = mysql_fetch_assoc($comm_r);
if ($comm['id']) {
if ($u['access'] > 0 or ($u['id'] == $comm['id_user'] and TIME - $comm['time'] < $config['edit_time']) ) {
tp($lang['edit_comm']);
if ($ok) {
$text = check($_POST['text']);
if ($text) {
mysql_query("UPDATE `".$type."_comm` SET `id_".$type."` = '".$comm['id_'.$type]."', `text` = '$text', `edit_by` = '$u[id]', `edit_time` = '".TIME."' WHERE `id` = '$id'");
redirect('?act=comm&id='.$comm['id_'.$type]);
} else {
redirect('?act=comm_edit&id='.$id);
}
} else {
echo '<div class="body"><form name="form" action="?act=comm_edit&id='.$id.'&ok=1" method="post">
'.bbpanel('form', 'text').'<textarea name="text" cols="" rows="3">'.$comm['text'].'</textarea>
<input name="submit" type="submit" value="Ok" />
</form>
<a href="?act=comm&p='.$page.'&id='.$comm['id_'.$type].'#'.$comm['id'].'">Назад</a>» ред-ть комментарий
</div>';
}
} else {
redirect('?act=comm&id='.$comm['id_'.$type]);
}
} else {
redirect('?');
}
} else {
redirect('login.php');
}
?>