Файл: api_forum/delete_post.php
Строк: 14
<?
////////////////////////////////////////
///// Основа ApiCMS //////
///// Автор биллинга - IvanDanilov /////
///// Автор биллинга - IvanDanilov /////
///// ICQ 936545, mail: KyberID@ya.ru //
////////////////////////////////////////
/////////////////////////////////////////
$title = 'Удаление';
require_once '../api_core/apicms_system.php';
require_once '../api_core/head.php';
/////////////////////////////////////////
$theme_id = intval($_GET['theme']);
/////////////////////////////////////////
if (!isset($user)) header('location: index.php');
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `api_forum_post` WHERE `id` = '".intval($_GET['id'])."'"),0)==1 && mysql_result(mysql_query("SELECT COUNT(*) FROM `api_forum_theme` WHERE `id` = '".$theme_id."'"),0)==1){
$post=mysql_fetch_assoc(mysql_query("SELECT * FROM `api_forum_post` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1"));
if (isset($user) && $user['id'] == $post['id_user'] or $user['level']==1 or $user['level']==2 && $post['delete']==0){
$msg = 'Сообщение удалено';
mysql_query("UPDATE `api_forum_post` SET `text` = '$msg', `delete` = '1', `delete_time` = '$time' WHERE `id` = '$post[id]' LIMIT 1");
header("Location: theme.php?id=".$theme_id."");
}
}else{
echo "<div class='erors'>Ошибка удаления</div>n";
}
//////////////////////////////////////////
apicms_foot();
?>