Joywork/ajax/deleteEventSubComment.php

31 lines
940 B
PHP
Raw Normal View History

2026-05-22 20:21:54 +02:00
<?php
require_once($_SERVER['DOCUMENT_ROOT']."/config.php");
if ($_SESSION['id'] && isset($_POST['eventId'])) {
$post = clearInputData($_POST);
$event_id = $post['eventId'];
$from = $post['from'];
$sub_id = (int)$post['sub_id'];
if (!empty($from)) {
if ($from == "objects"){
if($sub_id > 0){
$sql = "DELETE FROM `user_sub_comments` WHERE id={$sub_id}";
} else {
$sql = "DELETE FROM `user_sub_comments` WHERE `event_id` = '$event_id' AND `section_id` = 1 AND `created_by` = '$_SESSION[id]'";
}
}
else if ($from == "clients")
$sql = "DELETE FROM `user_sub_comments` WHERE `event_id` = '$event_id' AND `section_id` = 2 AND `created_by` = '$_SESSION[id]'";
else if ($from == "requisitions")
$sql = "DELETE FROM `user_sub_comments` WHERE `event_id` = '$event_id' AND `section_id` = 3 AND `created_by` = '$_SESSION[id]'";
if (!empty($sql))
mysql_query($sql);
}
}