$tablename = "sections"; $dsiSections = new Display($tablename); $PageDataDisplay = $dsiSections->getAllData(); } catch (Exception $exc) { echo $exc->getMessage(); } include 'veiws/addNewPage.php'; } } // Delete: if (isset($_GET['action']) and $_GET['action'] == "delete") { try { $tablename = "pages"; $id = $_GET['id']; $deSec = new Delete($tablename); $deSec->deletRecordByID($id); } catch (Exception $exc) { echo $exc->getMessage(); } } //edit if (isset($_GET['action']) and $_GET['action'] == "edit") { $id = $_GET['id']; $tablename = "pages"; $displaypagedata = new Display($tablename); $pagedata = $displaypagedata->getRecordByID($id); $tablename = "sections"; $dsiSections = new Display($tablename); $PageDataDisplay = $dsiSections->getAllData(); include 'veiws/editPage.php'; if (isset($_POST['submit']) && $_POST['submit'] == "Edit") {
if (isset($_GET['action']) and $_GET['action'] == "delete") { try { $tablename = "banners"; $id = $_GET['id']; // get the banner url via id $getbanner = new Display($tablename); $banner = $getbanner->getRecordByID($id); // delete the file $filesToDelete[] = $banner['bannerUrl']; $delete = new DeleteFile($filesToDelete); if ($delete == TRUE) { echo "Files successfuly deleted."; } // Delete from database banners table $debanner = new Delete($tablename); $debanner->deletRecordByID($id); } catch (Exception $exc) { echo $exc->getMessage(); } } if (isset($_POST['submit']) && $_POST['submit'] == 'Upload') { if (isset($_FILES)) { try { $file = $_FILES['image']; $allowedExts = array('jpg', 'png'); $uploadsDirecotry = "resources/uploads/"; $maxSize = 4000000; $upload = new Upload($file, $allowedExts, $uploadsDirecotry, $maxSize); $upload->uploadFiles(); $filenames = $upload->getFilesNames(); /*