if (!isUserLoggedIn()) { header("Location: login.php"); die; } if (isset($_GET['id'])) { if (is_numeric($_GET['id'])) { $id = $_GET['id']; require_once "models/dbcontroller.php"; $images = dbcontroller::getHomeSliderList(); $ids = array(); foreach ($images as $image) { $ids[] = $image['_id']; } if (in_array($id, $ids)) { if (dbcontroller::deleteHomeSlider($id)) { if (unlink("images/home-slider/" . dbcontroller::getImageNameByID($images, $id))) { header("location: admin_home.php?msg=successdelete"); } else { header("location: admin_home.php?msg=db-error"); } } else { header("location: admin_home.php?msg=error"); } } else { header("location: admin_home.php?msg=error"); } } else { header("location: admin_home.php?msg=error"); } } else { header("location: admin_home.php?msg=error");