Esempio n. 1
0
                    $editPage['page_image'] = $uploadsDirecotry . $upload->getFileUrl();
                } catch (Exception $exc) {
                    $exc->getMessage();
                }
            } else {
                $editPage['page_image'] = 'resources/images/logo.png';
            }
            $tabename = "pages";
            $id = $_GET['id'];
            try {
                $updatePage = new Update($editPage, $tabename);
                $updatedPage = $updatePage->editData($id);
                if ($updatedPage) {
                    echo '<script type="text/javascript"> alert("The New Page was updated !"); history.back();</script>';
                }
            } catch (Exception $exc) {
                echo $exc->getMessage();
            }
        }
    }
} else {
    $tablename = "pages";
    $displaypages = new Display($tablename);
    $PagesDataDisplay = $displaypages->getAllData();
    for ($i = 0; $i < count($PagesDataDisplay); $i++) {
        $id = $PagesDataDisplay[$i]['sectionId'];
        $display = new Display('sections');
        $sectionNames[$i] = $display->getRecordByID($id);
    }
    include 'veiws/pages.php';
}
Esempio n. 2
0
<?php

// header.php
include 'site/header.php';
// contents start
echo '<div id="contents">';
// sider bar
include 'site/sidebar.php';
echo '<div id="conts">';
echo '<div id="page">';
/*
 * id = $_GET['id']
 */
$id = $_GET['id'];
$tablename = "pages";
$displaypages = new Display($tablename);
$PagesDataDisplay = $displaypages->getRecordByID($id);
echo '    
<h1>' . $PagesDataDisplay['page_name'] . '</h1>
<img style="max-width:300px; margin:20px 0;" src="app/' . $PagesDataDisplay['page_image'] . '">
<p>
    ' . $PagesDataDisplay['page_content'] . '
</p>
    
    ';
echo '</div>';
echo '</div>';
echo '</div>';
// footer.php
include 'site/footer.php';
Esempio n. 3
0
 if (isset($_GET['action']) and $_GET['action'] == "delete") {
     try {
         $tablename = "sections";
         $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 = "sections";
     $editSecDis = new Display($tablename);
     $recSecdata = $editSecDis->getRecordByID($id);
     include 'veiws/editSection.php';
 }
 if (isset($_POST['submit']) && $_POST['submit'] == "Edit") {
     //sections: id, sectionName, sectionStaus, sectionLocation, sectionDesc, sectionDate, username
     $SecDataedit['sectionName'] = $_POST['sectionName'];
     $SecDataedit['sectionStaus'] = $_POST['sectionStaus'];
     $SecDataedit['sectionLocation'] = $_POST['sectionLocation'];
     $SecDataedit['sectionDesc'] = $_POST['sectionDesc'];
     try {
         $tablename = "sections";
         $SecUpdate = new Update($SecDataedit, $tablename);
         $updtSec = $SecUpdate->editData($id);
         if ($updtSec) {
             echo '<script type="text/javascript"> alert("The Section was updated !"); history.back();</script>';
         }
Esempio n. 4
0
<h3>Banery</h3>
<?php 
include '../includes/init.php';
include '../includes/autoloader.php';
if ($_POST or @$_GET['action']) {
    // Delete:
    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');