:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/public_html/kreativecrm/**
:: Editing File: ticket_delete.php
<?php include 'config/db.php'; // --- Validate ID --- if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { header("Location: ticket_list.php?msg=Invalid Ticket ID"); exit; } $id = intval($_GET['id']); // --- Check if ticket exists --- $check = mysqli_query($conn, "SELECT attachment FROM tickets WHERE id = $id"); if (mysqli_num_rows($check) == 0) { header("Location: ticket_list.php?msg=Ticket Not Found"); exit; } $row = mysqli_fetch_assoc($check); // --- Delete attachment file (if exists) --- if (!empty($row['attachment'])) { $file_path = "uploads/tickets/" . $row['attachment']; if (file_exists($file_path)) { unlink($file_path); } } // --- Delete ticket record --- mysqli_query($conn, "DELETE FROM tickets WHERE id = $id"); // --- Redirect with success message --- header("Location: ticket_list.php?msg=Ticket Deleted Successfully"); exit; ?>