<?php header('Content-Type: application/json'); 
include '../koneksi.php'; // Titik dua kali artinya naik satu folder ke atas
$id_laporan = $_POST['id_laporan_wali'] ?? '';
if (empty($id_laporan)) { echo json_encode(["status" => false, "message" => "ID Laporan tidak ditemukan"]); exit; }
// Opsional: Hapus juga file fotonya di laptop jika ada $res = mysqli_query($koneksi, "SELECT foto1, foto2, foto3 FROM laporan_wali WHERE id_laporan_wali = '$id_laporan'"); $row = mysqli_fetch_assoc($res); if($row) { if(!empty($row['foto1'])) unlink("img_wali/".$row['foto1']); if(!empty($row['foto2'])) unlink("img_wali/".$row['foto2']); if(!empty($row['foto3'])) unlink("img_wali/".$row['foto3']); }
$sql = "DELETE FROM laporan_wali WHERE id_laporan_wali = '$id_laporan'";
if (mysqli_query($koneksi, $sql)) { echo json_encode(["status" => true, "message" => "Laporan berhasil dihapus"]); } else { echo json_encode(["status" => false, "message" => mysqli_error($koneksi)]); } ?>