:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/soulmeetvivah.com/member/php/**
:: Editing File: delete_photo.php
<?php include('db.php'); if (!isset($_POST['id']) || !isset($_POST['user_id'])) { echo "Missing required parameters"; exit; } // Check if photo_gallery table exists $table_check = mysqli_query($conn, "SHOW TABLES LIKE 'photo_gallery'"); if (!$table_check || mysqli_num_rows($table_check) == 0) { echo "Photo gallery table does not exist"; exit; } $photo_id = mysqli_real_escape_string($conn, $_POST['id']); $user_id = mysqli_real_escape_string($conn, $_POST['user_id']); // First, get the image name to delete the file $sql_get_image = "SELECT img_name FROM photo_gallery WHERE photo_id = '$photo_id' AND user_id = '$user_id'"; $result_get_image = mysqli_query($conn, $sql_get_image); if (mysqli_num_rows($result_get_image) > 0) { $row = mysqli_fetch_assoc($result_get_image); $img_name = $row['img_name']; // Delete from database $sql_delete = "DELETE FROM photo_gallery WHERE photo_id = '$photo_id' AND user_id = '$user_id'"; if (mysqli_query($conn, $sql_delete)) { // Delete the physical file $file_path = '../../admin/images/members/' . $img_name; if (file_exists($file_path)) { unlink($file_path); } echo "1"; } else { echo "Failed to delete: " . mysqli_error($conn); } } else { echo "Photo not found or you don't have permission to delete it"; } ?>