Sabtu, 20 Desember 2014

CODEWEB | Add Artikel di Website

Berikut source code untuk tambah artikel di website, jika kurang jelas bisa tinggalkan pertanyaan dikolom komentar. Langsung saja copy-pastekan pada dreamweaver dan sesuaikan pada huruf yang berwarna merah.


<?php
session_start();
include ("sesuaikan sendiri.php");
if ($_SESSION['username'] && $_SESSION['password'])
{
?>
<?php
    $sql = mysql_query("SELECT * FROM user WHERE username='".$_SESSION['username']."' AND password='".$_SESSION['password']."'");
    $hasil = mysql_fetch_assoc($sql);
}
else{
    header("location:sesuaikanjuga.php");
}
?>


<html>
<head>
<meta charset="utf-8">
    <title>Tambah Artikel</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="../css/bootstrap.css" rel="stylesheet">
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
      .sidebar-nav {
        padding: 9px 0;
      }

      @media (max-width: 980px) {
        /* Enable use of floated navbar text */
        .navbar-text.pull-right {
          float: none;
          padding-left: 5px;
          padding-right: 5px;
        }
      }
    </style>
    <link href="../css/bootstrap-responsive.css" rel="stylesheet">

   
      <script src="../assets/js/html5shiv.js"></script>
   

  
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../ico/apple-touch-icon-57-precomposed.png">
    <link rel="shortcut icon" href="../ico/favicon.png">
</head>

<body>
<div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container-fluid">
          <a class="brand" href="#">
<?php echo "Halaman Administrator";?>
 </a>
          <div class="nav-collapse collapse">
            <p class="navbar-text pull-right">
            </p>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Dasboard</li>
<li class="active"><a href="./index.php">Profil Admin</a></li>
<li class="nav-header">Menu Artikel</li>
<li><a href="./tambah_artikel.php">Tambah Artikel</a></li>
<li><a href="./edit_artikel.php">Edit Artikel</a></li>
<li><a href="#">Galeri</a></li>
</ul>
</div><!--/.well -->
</div><!--/span-->

<div class="span9 well">
<form action="proses_addpost.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="id_berita" value="">
<table border="0">
<tr>
<td>Judul</td>
<td>: <input class="span9" type="text" name="judul" size="50" required value=""></td>
</tr>
<tr>
<td>Kategori</td>
<td>: 
<select class="span9" name="kategori" required>
<option value="">-- Kategori --</option>
<option value="Sekolah">Sekolah</option>
<option value="Guru">Guru</option>
<option value="Siswa">Siswa</option>
</select>
</td>
</tr>
<tr>
<td>Penulis</td>
<td>: <input class="span9" type="text" name="penulis" size="10" required value=""></td>
</tr>
<tr>
<td>File Foto</td>
<td>: <input class="span10" type="file" name="gambar" required></td>
</tr>
<tr><td><br></td></tr>
<tr>
<td>Isi Artikel</td>
<td>: <textarea class="span9" name="isi" rows="15" cols="40" required></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Simpan"></td>
</tr>
</table>
</form>
</div>
</div>

<footer>
        <p>Web &copy; 2014  -Tatik Budhi Astuti- </p>
    </footer>

</div>
    
</body>
</html>

Tidak ada komentar: