D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
diafrica
/
spre.dominicaninstitute.edu.ng
/
Filename :
edit-history-ghana-page.php
back
Copy
<?php session_start(); include './inc/functions.php'; $Functions = new Functions(); if (!isset($_SESSION['manager'])) { header('location: ./admin-auth'); exit(); } $page_title; $page_title = ucfirst(basename(__FILE__, '.php')); if ($page_title === 'index') { $page_title = 'Home'; } $page_title = "Administator's Dashboard"; include 'sections/pages-header.php'; $message = ''; function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } // if (isset($_GET['testimonial_id'])) { // $sn = $_GET['testimonial_id']; // $sql = "DELETE FROM testimonials WHERE id='$sn'"; // if (mysqli_query($con, $sql)) { // $message = 'Testimonial deleted successfully!'; // $_GET['testimonial_id'] = ''; // } else { // $message = 'Error deleting picture: ' . mysqli_error($con); // } // } ?> <div class="container" style="margin-top:50px"> <div> <a href="./mod-auth"><h2>Back to Admin Dashboard</h2></a> </div> <hr> <div> <h1>Update History Of Ghana OCDS</h1> <?php $file_name = $ckeditor = ''; if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['edit_history'])) { $file_name = $_FILES['image']['name']; $ckeditor = $_POST['ckeditor']; $file_path = 'uploads/pages/' . $file_name; move_uploaded_file($_FILES['image']['tmp_name'], $file_path); $feedback = " UPDATE pages SET content='$ckeditor', image='$file_name' WHERE page_name='history-ghana' "; $run = mysqli_query($con, $feedback); if ($feedback) { echo "<div class='alert alert-success alert-dismissible' role='alert'> History of Ghana OCDS updated Successfully! </div>"; } else { echo "<div class='alert alert-danger alert-dismissible' role='alert'> An error occured, please try again! </div>"; } } ?> <br> <?php // include 'inc/config.php'; global $con; $get_post = "select * from pages where page_name='history-ghana'"; $run_post = mysqli_query($con, $get_post); while ($row_post = mysqli_fetch_array($run_post)) { $contenter = $row_post['content']; $image = $row_post['image']; } ?> <form action="<?php echo htmlspecialchars( $_SERVER['PHP_SELF'] ); ?>" method="post" enctype="multipart/form-data"> <div class="row clearfix"> <div class="col-md-8 col-sm-12 col-xs-12"> <div class="form-group"> <p>History Page Picture</p> <img src="uploads/pages/<?= $image ?>"/> </div> <br/> <div class="form-group"> <p>Change Page Picture</p> <input type="file" name="image" class="form-control" size="60" value="<?= $image ?>" required> </div> <div class="form-group"> <p>History Page Content</p> <textarea name="ckeditor" class="form-control textarea required" ><?= $contenter ?></textarea> <script> CKEDITOR.replace( 'ckeditor' ); // 850 pixels wide. config.width = '100%'; config.height = '8700px' </script> </div> <div class="form-group"> <input type="submit" name="edit_history" value="Edit History" class="thm-btn thm-color width-100"/> </div> </div> </div> </form> </div> <hr> </div> </div> <?php include_once 'sections/footer.php'; ?>