Advertisement
Guest User

edit.php

a guest
Jun 25th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.61 KB | None | 0 0
  1.     <!doctype html>
  2.     <html class="no-js" lang="en" dir="ltr">
  3.  
  4.     <head>
  5.         <meta charset="utf-8">
  6.         <meta http-equiv="x-ua-compatible" content="ie=edge">
  7.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8.         <title>GONIT - Edit</title>
  9.         <link rel="icon" href="../../id/images/icon.ico">
  10.         <link rel="stylesheet" href="../../id/css/foundation.css">
  11.         <link rel="stylesheet" href="../../id/css/app.css">
  12.         <script src="../../id/js/ckeditor/ckeditor.js"></script>
  13.     </head>
  14.  
  15.     <body>
  16.         <div class="grid-y medium-grid-frame">
  17.             <?php include '../../id/element/admin/menu-admin-header.php';?>
  18.             <div class="cell medium-auto medium-cell-block-container">
  19.                 <div class="grid-x">
  20.                     <div class="body-background-dashboard2 medium-cell-block-y">
  21.                         <div class="grid-y grid-padding-y">
  22.                             <div class="large-12 medium-12 small-12 cell">
  23.                                 <div class="grid-x grid-padding-x grid-padding-y">
  24.                                     <div class="large-12 medium-12 small-12 title-text-dashboard2 cell">
  25.                                         <h5>
  26.                                             <?php
  27.                                             include '../../id/text/menu.php';
  28.                                             $hasil= strtoupper($posting4);
  29.                                             echo $hasil;
  30.                                             ?>
  31.                                         </h5>
  32.                                         <div class="line4"></div>
  33.                                         <div id="clockbox2"></div>
  34.                                         <script src="../../id/js/clock2.js"></script>
  35.                                     </div>
  36.                                 </div>
  37.                                 <?php
  38.                                 include "../../connection.php";
  39.  
  40.                                 if(!isset($_GET['blog_id'])){
  41.                                     die("Error: blog_id Tidak Dimasukkan");
  42.                                 }
  43.  
  44.                                 if(isset($_POST['submit'])){
  45.                                             // $user_id = htmlentities($_SESSION['user_id']);
  46.                                             // $blog_username = htmlentities($_SESSION['user_username']);
  47.                                     $blog_id = htmlentities($_GET['blog_id']);
  48.                                     $blog_cat_id = htmlentities($_POST['blog_cat_id']);
  49.                                     $blog_images = htmlentities($_POST['blog_images']);
  50.                                             // $blog_date = htmlentities(date('Y-m-d'));
  51.                                     $blog_title = htmlentities($_POST['blog_title']);
  52.                                     $blog_body = htmlentities($_POST['blog_body']);
  53.                                             // $blog_link = htmlentities($_POST['blog_link']);
  54.                                     $tw_blog = $db->prepare("UPDATE tw_blog SET blog_title = :blog_title, blog_cat_id = :blog_cat_id, blog_images = :blog_images, blog_body = :blog_body  WHERE blog_id = :blog_id");
  55.                                             // $tw_blog->BindParam(':user_id', $user_id);
  56.                                     $tw_blog->BindParam(':blog_id', $blog_id);
  57.                                             // $tw_blog->BindParam(':blog_username', $blog_username);
  58.                                     $tw_blog->BindParam(':blog_cat_id',$blog_cat_id);
  59.                                     $tw_blog->BindParam(':blog_images', $blog_images);
  60.                                             // $tw_blog->BindParam(':blog_date',  $blog_date);
  61.                                     $tw_blog->BindParam(':blog_title', $blog_title);
  62.                                     $tw_blog->BindParam(':blog_body', $blog_body);
  63.                                             // $tw_blog->BindParam(':blog_link', $blog_link);
  64.                                     $tw_blog->execute();
  65.  
  66.                                 }  
  67.                                 $query = $db->prepare("SELECT * FROM tw_blog WHERE blog_id = :blog_id");
  68.                                 $query->bindParam(":blog_id", $_GET['blog_id']);
  69.                                 $query->execute();
  70.                                
  71.                                 if($query->rowCount() == 0){
  72.                                     die("Error: blog_id Tidak Ditemukan");
  73.                                 }else{
  74.                                     $data = $query->fetch();
  75.                                 }
  76.  
  77.                                 ?>
  78.                                 <div class="grid-x grid-padding-x grid-padding-y">
  79.                                     <div class="large-12 medium-12 small-12 text-right cell">
  80.                                         <form method="post" name=form action="">
  81.                                             <input type="hidden" name="blog_link" value="">
  82.                                             <span>Author by: <?php echo $_SESSION['user_username']; ?></span>
  83.                                             <span><button class="posting" type="submit" name="submit" value="data"><img src="https://img.icons8.com/office/20/000000/submit-resume.png"> Publikasikan </button></span> &nbsp;&nbsp;
  84.                                             <span><a href="../../id/admin/blog"><img src="https://img.icons8.com/office/20/000000/close-window--v2.png"> Tutup</a></span>
  85.                                         </div>
  86.                                         <div class="large-12 medium-12 small-12 cell">
  87.                                             <label><h5>Judul</h5></label>
  88.                                             <input type="text" placeholder="Judul" name="blog_title" value="<?php echo $data['blog_title']; ?>" />
  89.                                             <div class="grid-x grid-padding-x grid-padding-y">
  90.                                                 <div class="large-2 medium-4 small-12 cell">
  91.                                                     <label><h5>Category</h5></label>
  92.                                                     <select name="blog_cat_id">
  93.                                                         <?php
  94.                                                         require_once("../../connection.php");
  95.                                                         $tw_category = $db->prepare("SELECT * FROM tw_category");
  96.                                                         $tw_category->execute();
  97.                                                         while($d = $tw_category->fetch(PDO::FETCH_ASSOC)){
  98.                                                             ?>
  99.                                                             <option value="<?=$d['blog_cat_id'];?>" <?php echo ($d['blog_cat_id'] ==  $data['blog_cat_id']) ? ' selected="selected"' : '';?> > <?=$d['cat_name'];?> </option>
  100.                                                         <?php } ?>
  101.                                                     </select>
  102.                                                 </div>
  103.                                             </div>
  104.                                             <label for="exampleFileUpload" class="button">Upload Gambar</label>
  105.                                             <input type="file" name="blog_images" id="exampleFileUpload" class="show-for-sr">
  106.                                             <div class="callout-height">
  107.                                                 <link href="../../id/css/quill.snow.css" rel="stylesheet">
  108.                                                 <label><h5>Isi</h5></label>
  109.                                                 <textarea name="blog_body" id="editor1" rows="10" cols="500"><?php echo $data['blog_body']; ?>
  110.                                             </textarea>
  111.                                             <script>
  112.                                                 CKEDITOR.replace( 'editor1' );
  113.                                             </script>
  114.                                         </div>
  115.                                     </div>
  116.                                 </form>
  117.                             </div>
  118.                         </div>
  119.                     </div>
  120.                 </div>
  121.             </div>
  122.         </div>
  123.     </div>
  124.  
  125.     <script src="../../id/js/vendor/jquery.js"></script>
  126.     <script src="../../id/js/vendor/what-input.js"></script>
  127.     <script src="../../id/js/vendor/foundation.js"></script>
  128.     <script src="../../id/js/app.js"></script>
  129.  
  130. </body>
  131.  
  132. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement