Вход Регистрация
Файл: modules/forum/delete_post.php
Строк: 47
<?php
/****
* @package LiveCMS
* @link livecms.org
* @author MyZik
* @version See attached file VERSION.txt
* @license See attached file LICENSE.txt
* @copyright Copyright (C) LiveCMS Development Team
****/

ob_start();
$lang_forum load_lng('forum'); // Подключаем файл языка

$title $lang_forum['forum']; // Заголовок страницы
$module 'forum'// Модуль

  /**
    * Проверка наличия авторизации
  **/
  
if (!isset($user)) {
    require_once(
HOME .'/incfiles/header.php');
    echo 
'<div class="error">' $lang['only_users'] . '</div>';
    echo 
'<div class="home">' .
    
'<img src="/design/themes/' $set_user['theme'] . '/images/back.png" alt="" /> <a href="/index.php">' $lang['back'] . '</a>' .
    
'</div>';
    require_once(
HOME .'/incfiles/footer.php');
      }

  
/**
    * Проверяем, задан ли параметр
  **/
  
if (!isset($_GET['id']) || empty($_GET['id']) || !is_numeric($_GET['id'])) {
    require_once(
HOME .'/incfiles/header.php');
    echo 
'<div class="error">' $lang['error_parameter'] . '</div>';
    echo 
'<div class="home">' .
    
'<img src="/design/themes/' $set_user['theme'] . '/images/back.png" alt="" /> <a href="index.php">' $lang['back'] . '</a>' .
    
'</div>';
    require_once(
HOME .'/incfiles/footer.php');
      }

  
/**
    * Проверяем наличие сообщения
  **/
  
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_forum_messages` WHERE `id` = '" num($_GET['id']) . "'"), 0) == 0) {
    require_once(
HOME .'/incfiles/header.php');
    echo 
'<div class="error">' $lang_forum['message_not_exists'] . '</div>';
    echo 
'<div class="home">' .
    
'<img src="/design/themes/' $set_user['theme'] . '/images/back.png" alt="" /> <a href="index.php">' $lang['back'] . '</a>' .
    
'</div>';
    require_once(
HOME .'/incfiles/footer.php');
      }

  
$ID num($_GET['id']);
  
$post mysql_fetch_assoc(mysql_query("SELECT * FROM `cms_forum_messages` WHERE `id` = '$ID' LIMIT 1"));
  
$pagesMess mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_forum_messages` WHERE `topic_id` = '" $post['topic_id'] . "'"), 0);
  
$ceil ceil($pagesMess $countMess);
  
$end_page = ($ceil '&page=' $ceil '');

  
/**
    * Проверяем права доступа
  **/
  
if (($user['rights'] == || $user['rights'] >= 7) && ($user_post['rights'] <= $user['rights']) || ($post['user_id'] == $user['id'])) {
        
mysql_query("DELETE FROM `cms_forum_messages` WHERE `id` = '$ID' LIMIT 1");
        
mysql_query("UPDATE `users` SET `balls` = `balls` - 1 WHERE `id` = '" $post['user_id'] . "' LIMIT 1");
        
mysql_query("UPDATE `users` SET `postsforum` = `postsforum` - 1 WHERE `id` = '" $post['user_id'] . "' LIMIT 1");
        
header("Location: topic.php?id=$post[topic_id]$end_page);
      } else {
        
header("Location: topic.php?id=$post[topic_id]$end_page);
}
ob_end_flush();
?>
Онлайн: 0
Реклама