if ($contestHeader != '' && file_exists(MEDIA_FILES_PATH . "contest-header/" . $contestHeader)) { if (unlink(MEDIA_FILES_PATH . "contest-header/" . $contestHeader)) { $HeaderDelParam = true; } else { $HeaderDelParam = false; } } if ($contestLogo != '' && file_exists(MEDIA_FILES_PATH . "contest-logo/" . $contestLogo)) { if (unlink(MEDIA_FILES_PATH . "contest-logo/" . $contestLogo)) { $logoDelParam = true; } else { $logoDelParam = false; } } if ($HeaderDelParam == true && $logoDelParam == true) { echo $contestObj->delete(); } else { $json = array("status" => 0, "msg" => $thisPage->showPlainErrors("Contest Deletion Failed! ERR: Image Problems")); $dbObj->close(); //Close Database Connection header('Content-type: application/json'); echo json_encode($json); } } else { $json = array("status" => 0, "msg" => $thisPage->showPlainErrors($errorArr)); $dbObj->close(); //Close Database Connection header('Content-type: application/json'); echo json_encode($json); } }