if (isset($_POST['image-1']) && isset($_POST['image-2'])) { if (is_numeric($_POST['image-1']) && is_numeric($_POST['image-2'])) { $id1 = $_POST['image-1']; $id2 = $_POST['image-2']; require_once "models/dbcontroller.php"; $images = dbcontroller::getHomeSliderList(); $flag1 = false; $flag2 = false; foreach ($images as $img) { if ($img['_id'] == $id1) { $flag1 = true; } if ($img['_id'] == $id2) { $flag2 = true; } } if ($flag1 && $flag2) { if (dbcontroller::swapImagesHomeSlider($id1, $id2)) { header("location: admin_home.php?msg=success-swap"); } else { header("location: admin_home.php?msg=error-db-swap"); } } else { header("location: admin_home.php?msg=error-swap"); } } else { header("location: admin_home.php?msg=error-swap"); } } else { header("location: admin_home.php?msg=error-swap"); }