:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/public_html/crm/**
:: Editing File: vcard_social_links_delete.php
<?php ob_start(); include 'header.php'; /* =============================== PATH CONFIG (MATCH ADD / EDIT) =============================== */ // Filesystem base path define( 'VCARD_UPLOAD_PATH', $_SERVER['DOCUMENT_ROOT'] . '/kreativecrm/uploads/vcard/' ); /* =============================== VALIDATE ID =============================== */ if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { header("Location: vcard_social_links_list.php?msg=Invalid Social Link ID"); exit; } $id = intval($_GET['id']); /* =============================== FETCH SOCIAL LINK =============================== */ $q = mysqli_query( $conn, "SELECT id, vcard_id, icon FROM vcard_social_links WHERE id = '$id'" ); if (!$q || mysqli_num_rows($q) === 0) { header("Location: vcard_social_links_list.php?msg=Social Link 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_social_links_list.php?msg=VCard Not Found"); exit; } $vcard = mysqli_fetch_assoc($vcard_q); $slug = $vcard['card_slug']; /* =============================== SOCIAL ICON DIRECTORY =============================== */ $icon_dir = VCARD_UPLOAD_PATH . $slug . '/social/'; /* =============================== DELETE ICON FILE (IF EXISTS) =============================== */ if (!empty($row['icon'])) { $icon_path = $icon_dir . $row['icon']; if (file_exists($icon_path)) { unlink($icon_path); } } /* =============================== DELETE DB RECORD =============================== */ mysqli_query($conn, "DELETE FROM vcard_social_links WHERE id = '$id'"); /* =============================== OPTIONAL: REMOVE EMPTY SOCIAL FOLDER =============================== */ if (is_dir($icon_dir)) { $files = glob($icon_dir . '*'); if (!$files) { rmdir($icon_dir); } } /* =============================== REDIRECT =============================== */ header("Location: vcard_social_links_list.php?msg=Social Link Deleted Successfully"); exit; ?>