D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
diafrica
/
spre.dominicaninstitute.edu.ng
/
Filename :
edit-ourmission.php
back
Copy
<?php session_start(); include 'inc/config.php'; 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['mis_id'])) { $sn = $_GET['mis_id']; if($sn < 0){ echo "Patched by TTEAM"; exit; } if(!is_numeric($sn)){ echo "Patched by TTEAM"; exit; } $get_news = "select * from ourmission where id='$_GET[mis_id]'"; $run_post = mysqli_query($con, $get_news); while ($row_post = mysqli_fetch_array($run_post)) { $titler = $row_post['title']; //$category = $row_post['content']; //$dater = $row_post['dater']; $uploaded_image = $row_post['image']; $contenter = $row_post['content']; } } ?> <div class="container" style="margin-top:50px"> <div> <a href="./edit-ourmission"><h2>Manage Our Mission</h2></a> </div> <hr> <div> <h1>Update Our Mission</h1> <?php if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update_news']) ) { $title = $caption = $image = $ckeditor = ''; $title = test_input($_POST['title']); //$dater = test_input($_POST['dater']); //$caption = test_input($_POST['caption']); $ckeditor = $_POST['ckeditor']; if($ckeditor < 0){ echo "Patched by TTEAM"; exit; } if(!is_numeric($ckeditor)){ echo "Patched by TTEAM"; exit; } $file_name = $_FILES['image']['name'] ? $_FILES['image']['name'] : $uploaded_image; $file_path = 'uploads/others/' . $file_name; move_uploaded_file($_FILES['image']['tmp_name'], $file_path); $feedback = "UPDATE ourmission SET title='$title',content='$ckeditor', image='$file_name'"; // echo $feedback; // exit(); $run = mysqli_query($con, $feedback); if ($feedback) { echo "<div class='alert alert-success alert-dismissible' role='alert'> Our Mission Updated Successfully! </div>"; } else { echo "<div class='alert alert-danger alert-dismissible' role='alert'> An error occured, please try again! </div>"; } } ?> <?php $get_news = "select * from ourmission"; $run_post = mysqli_query($con, $get_news); while ($row_post = mysqli_fetch_array($run_post)) { $title = $row_post['title']; //$caption = $row_post['caption']; //$dater = $row_post['dater']; $uploaded_image = $row_post['image']; $content = $row_post['content']; } ?> <br> <form action="" 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"> <input type="text" name="title" class="form-control" value="<?= $title ?>" placeholder="Add Title" required> </div> <!-- <div class="form-group"> <input type="text" name="caption" class="form-control" placeholder="Add Community location" value=""required> </div> --> <div class="form-group"> <img src="uploads/others/<?= $uploaded_image ?>" style="width: 300px"/> <p>Change Our Mission Image Image dimension: 371 x 206</p> <input type="file" name="image" class="form-control" size="60"> </div> <!-- <div class="form-group"> <input type="date" name="dater" class="form-control" value=" //$dater ?>" required> </div> --> <div class="form-group"> <textarea name="ckeditor" class="form-control textarea required" ><?= $content ?></textarea> <script> CKEDITOR.replace( 'ckeditor' ); // 850 pixels wide. config.width = '100%'; config.height = '8700px' </script> </div> <div class="form-group"> <input type="submit" name="update_news" value="Update Mission" class="thm-btn thm-color width-100"/> </div> </div> </div> </form> </div> <hr> </div> <div> <h1>Welcome Message</h1> <?php if (!empty($message)): ?> <div class='alert alert-danger alert-dismissible show' role="alert"> <?= $message ?> </div> <?php endif; ?> <?php include_once './inc/config.php'; $serial = 0; $sql = 'SELECT * FROM ourmission'; $result = mysqli_query($con, $sql); ?> <table id="example" class="display" style="width:100%"> <thead> <tr> <th>S/N</th> <!-- <th>Images</th> --> <th>Title</th> <th>Caption</th> <th colspan="2">Actions</th> <th></th> </tr> </thead> <tbody> <?php if (mysqli_num_rows($result) > 0) { // output data of each row while ($row = mysqli_fetch_assoc($result)) { ?> <tr> <td><?= ++$serial ?></td> <!-- <td><img scr="./uploads/news/ //$row['image'] ?>"/></td> --> <td><?= $row['title'] ?></td> <td><?= $row['content'] ?></td> <td colspan="2"> <a href="edit-ourmission?mis_id=<?= $row[ 'id' ] ?>" class="btn btn-success">Edit</a> </td> <td><a href="edit-ourmission?mis_id=<?= $row[ 'id' ] ?>" class="btn btn-danger">Delete</a> </td> </tr> <?php } } else { //echo '0 results'; } ?> </tbody> </table> </div> </div> <?php include_once 'sections/footer.php'; ?>