:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/public_html/crm/**
:: Editing File: vcard_service_delete.php
<?php ob_start(); include 'header.php'; /* =============================== PATH CONFIG =============================== */ define( 'VCARD_UPLOAD_PATH', $_SERVER['DOCUMENT_ROOT'] . '/kreativecrm/uploads/vcard/' ); /* =============================== VALIDATE ID =============================== */ if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { header("Location: vcard_service_list.php?msg=Invalid Service ID"); exit; } $id = intval($_GET['id']); /* =============================== FETCH SERVICE =============================== */ $q = mysqli_query( $conn, "SELECT id, vcard_id, icon FROM vcard_services WHERE id = '$id'" ); if (!$q || mysqli_num_rows($q) === 0) { header("Location: vcard_service_list.php?msg=Service Not Found"); exit; } $row = mysqli_fetch_assoc($q); /* =============================== FETCH VCARD SLUG =============================== */ $vcard_q = mysqli_query( $conn, "SELECT card_slug FROM vcards WHERE id = '{$row['vcard_id']}'" ); if (!$vcard_q || mysqli_num_rows($vcard_q) === 0) { header("Location: vcard_service_list.php?msg=VCard Not Found"); exit; } $vcard = mysqli_fetch_assoc($vcard_q); $slug = $vcard['card_slug']; /* =============================== SERVICE DIRECTORY =============================== */ $service_dir = VCARD_UPLOAD_PATH . $slug . '/services/'; /* =============================== DELETE ICON FILE =============================== */ if (!empty($row['icon'])) { $icon_path = $service_dir . $row['icon']; if (file_exists($icon_path)) { unlink($icon_path); } } /* =============================== DELETE DB RECORD =============================== */ mysqli_query($conn, "DELETE FROM vcard_services WHERE id = '$id'"); /* =============================== REMOVE EMPTY SERVICES FOLDER =============================== */ if (is_dir($service_dir)) { $files = glob($service_dir . '*'); if (!$files) { rmdir($service_dir); } } /* =============================== REDIRECT =============================== */ header("Location: vcard_service_list.php?msg=Service deleted successfully"); exit; ?>