Advertisement
wahyu_f14

detail-berita.php

Aug 28th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.86 KB | None | 0 0
  1. <?php
  2. include "koneksi/koneksi.php";
  3. session_name('profil');
  4. session_start();
  5. if (isset($_SESSION['profil-username'])) {
  6.   if (isset($_GET['id'])) {
  7.     $get_detail_berita = mysqli_query($db, "SELECT * FROM berita WHERE id='".$_GET['id']."'");
  8.     if (mysqli_num_rows($get_detail_berita) > 0) {
  9.       $detail = mysqli_fetch_array($get_detail_berita);
  10.       ?>
  11.  
  12.       <!DOCTYPE html>
  13.       <html>
  14.       <head>
  15.         <meta charset="UTF-8">
  16.         <title>Input Penelitian | Sistem Informasi Perikanan Palabuhanratu</title>
  17.         <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
  18.         <!-- bootstrap 3.0.2 -->
  19.         <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
  20.         <!-- font Awesome -->
  21.         <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css" />
  22.         <!-- Ionicons -->
  23.         <link href="css/ionicons.min.css" rel="stylesheet" type="text/css" />
  24.         <!-- Theme style -->
  25.         <link href="css/AdminLTE.css" rel="stylesheet" type="text/css" />
  26.         <!-- Favicon -->
  27.         <link rel="shortcut icon" href="img/favicon.ico" />
  28.         <!-- bootstrap wysihtml5 - text editor -->
  29.         <link href="css/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css" />
  30.         <style>
  31.           .callout {
  32.             margin-bottom: 0;
  33.           }
  34.           .row {
  35.             margin-bottom: 15px;
  36.           }
  37.           .wysiwyg {
  38.             width: 100%;
  39.             height: 200px;
  40.             font-size: 14px;
  41.             line-height: 18px;
  42.             border: 1px solid #dddddd;
  43.             padding: 10px;
  44.           }
  45.           .wysiwyg:focus{
  46.             border-color: #3c8dbc !important;
  47.             box-shadow: none;
  48.             outline: 0;
  49.           }
  50.     #txt-file {
  51.           padding: 5px 5px;
  52.         }
  53.       </style>
  54.     </head>
  55.     <body class="skin-blue">
  56.  
  57.       <?php include 'includes/header.php'; ?>
  58.  
  59.       <div class="wrapper row-offcanvas row-offcanvas-left">
  60.         <!-- Left side column. contains the logo and sidebar -->
  61.         <?php include 'includes/menu.php'; ?>
  62.  
  63.         <!-- Right side column. Contains the navbar and content of the page -->
  64.         <aside class="right-side">
  65.           <!-- Content Header (Page header) -->
  66.           <section class="content-header">
  67.             <h1>
  68.               Berita
  69.               <small><i class="fa fa-angle-right"></i>&nbsp; Detail Berita</small>
  70.             </h1>
  71.           </section>
  72.  
  73.           <!-- Main content -->
  74.           <section class="content">
  75.  
  76.             <!-- top row -->
  77.             <div class="row">
  78.               <div class="col-md-10">
  79.                 <!-- general form elements -->
  80.                 <div class="box box-info">
  81.                   <div class="box-header">
  82.                     <h3 class="box-title"><i class="fa fa-edit"></i>&nbsp; FORM UBAH BERITA</h3>
  83.                   </div><!-- /.box-header -->
  84.  
  85.                   <?php
  86.                   // -------------------- SIMPAN BERITA -----------
  87.                   if (isset($_POST['simpan-berita'])) {
  88.                     $judul       = $_POST['judul'];
  89.                     $isi         = $_POST['isi'];
  90.                     $label       = $_POST['label'];
  91.  
  92.                     $update_berita = mysqli_query($db, "UPDATE berita SET judul='$judul', isi='$isi', label='$label' WHERE id='".$_GET['id']."'");
  93.  
  94.                     if ($update_berita == true) {
  95.                       echo "<script>alert('Berita telah diperbarui')</script>";
  96.                     } else {
  97.                       echo "<script>alert('Gagal memperbarui data. ".mysqli_error($db)."')</script>";
  98.                     }
  99.                   }
  100.                   ?>
  101.  
  102.                   <!-- form start -->
  103.                   <form role="form" method="POST">
  104.                     <div class="box-body">
  105.                       <div class="form-group">
  106.                         <label for="txt-judul">Judul Berita</label>
  107.                         <input type="text" class="form-control" name="judul" value="<?php echo $detail['judul']; ?>" required autofocus />
  108.                       </div>
  109.                       <div class="form-group">
  110.                         <textarea class="wysiwyg" name="isi" placeholder="Isikan konten berita di sini ..." required>
  111.                           <?php echo $detail['isi']; ?>
  112.                         </textarea>
  113.                       </div>
  114.                       <div class="row">
  115.                         <div class="col-xs-7">
  116.                           <label>Label</label>
  117.                           <input type="text" name="label" class="form-control" value="<?php echo $detail['label']; ?>" required />
  118.                         </div>
  119.                       </div>
  120.                     </div><!-- /.box-body -->
  121.                     <div class="box-footer">
  122.                       <button type="submit" name="simpan-berita" class="btn btn-info"><i class="fa fa-check"></i> &nbsp; Simpan Perubahan</button>
  123.                       <a type="button" class="btn btn-default" href="data-berita.php"><i class="fa fa-arrow-left"></i> &nbsp; Kembali</a>
  124.                     </div>
  125.                   </form>
  126.  
  127.                 </div><!-- /.box -->
  128.               </div><!-- /.col -->
  129.             </div>
  130.             <!-- /.row -->
  131.  
  132.           </section><!-- /.content -->
  133.         </aside><!-- /.right-side -->
  134.       </div><!-- ./wrapper -->
  135.  
  136.       <!-- add new calendar event modal -->
  137.  
  138.       <!-- jQuery 2.0.2 -->
  139.       <script src="js/jquery.min.js"></script>
  140.       <!-- jQuery UI 1.10.3 -->
  141.       <script src="js/jquery-ui-1.10.3.min.js" type="text/javascript"></script>
  142.       <!-- Bootstrap -->
  143.       <script src="js/bootstrap.min.js" type="text/javascript"></script>
  144.       <!-- AdminLTE App -->
  145.       <script src="js/AdminLTE/app.js" type="text/javascript"></script>
  146.  
  147.       <!-- InputMask -->
  148.       <script src="js/plugins/input-mask/jquery.inputmask.js" type="text/javascript"></script>
  149.       <script src="js/plugins/input-mask/jquery.inputmask.date.extensions.js" type="text/javascript"></script>
  150.       <script src="js/plugins/input-mask/jquery.inputmask.extensions.js" type="text/javascript"></script>
  151.       <!-- Bootstrap WYSIHTML5 -->
  152.       <script src="js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script>
  153.  
  154.       <!-- Inline Scripts -->
  155.       <script type="text/javascript">
  156.         /* wysiwyg */
  157.         $(".wysiwyg").wysihtml5({
  158.           "font-styles": true,
  159.           "emphasis": true,
  160.           "lists": true,
  161.           "html": false,
  162.           "link": false,
  163.           "image": false,
  164.           "color": true
  165.         });
  166.       </script>
  167.     </body>
  168.     </html>
  169.  
  170.     <?php
  171.   } else {
  172.     header('location:data-berita.php');
  173.   }
  174. } else {
  175.   header('location:data-berita.php');
  176. }
  177. } else {
  178.   header('location:login.php');
  179. }
  180. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement