<?php

include "../../config/master.php";
allowRoles([1,5]);

$id = intval($_GET['id'] ?? 0);

$data = mysqli_fetch_assoc(mysqli_query($conn,"SELECT * FROM village_sliders WHERE id='$id'"));

if($data){

/* DELETE IMAGE */

if(!empty($data['image'])){
$file = "../../uploads/sliders/".$data['image'];
if(file_exists($file)){
unlink($file);
}
}

/* DELETE RECORD */

mysqli_query($conn,"DELETE FROM village_sliders WHERE id='$id'");

}

header("Location: sliders_list.php");
exit;
?>