google.com, pub-9922355301914235, DIRECT, f08c47fec0942fa0 PENJUALAN ONLINE DENGAN CRUD - Tutorial Kampus
Banner IDwebhost

PENJUALAN ONLINE DENGAN CRUD



====================== HALAMAN ADMIN ===================


1.       1. Index.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>halaman admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
 <link rel="stylesheet" href="style.css">


 <script type="text/javascript" src="jquery.js"></script>

<style type="text/css">
<!--
body {
                background-color: #000033;
}
a:link {
                color: #0000FF;
                text-decoration: none;
}
a:visited {
                text-decoration: none;
                color: #0000FF;
}
a:hover {
                text-decoration: none;
                color: #000000;
}
a:active {
                text-decoration: none;
                color: #FFFFFF;
}
.style1 {color: #FFFFFF}
-->
</style></head>

<body>
<div align="center">
  <table width="100" border="0" cellpadding="0">
    <tr>
      <td><img src="banner-admin.jpg" width="961" height="208"></td>
    </tr>
    <tr>
      <td height="250" align="center" valign="top" bgcolor="#FFFFFF"><p>SELAMAT DATANG DI HALAMAN ADMINISTRATOR</p>
        <table border="1">
          <tr>
            <div class="panel panel-default">
                                                <form action="proses_login.php" method="post">
                                                                <div class="col-md-4 col-md-offset-4 kotak">
                                                                                <h3><span class="glyphicon glyphicon-hand-down"></span>Silahkan Login</h3>
                                                                                <div class="input-group">
                                                                                                <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
                                                                                                <input name="user" placeholder="Username" type="text" id="user2">
                                                                                </div>
                                                                                <div class="input-group">
                                                                                                <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
<input name="pass" placeholder="Password" type="password" id="pass2">                                                                        </div>
                                                                                <div class="input-group">                                           
<input type="submit" name="Submit" class="btn btn-primary" value="Login">                                                                   </div>
                                                                </div></form></td>
          </tr>
        </table>        <p>&nbsp;</p></td>
    </tr>
    <tr align="center" valign="middle" bgcolor="#000099">
      <td><span class="style1">
    </tr>
  </table>
</div>
</body>
</html>




2.       2. Index2.php
<?php session_start(); ?>
<?php if (!empty($_SESSION['usernameku']) && !empty($_SESSION['passwordku'])) { ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>halaman admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
        background-color: #000033;
}
a:link {
        color: #0000FF;
        text-decoration: none;
}
a:visited {
        text-decoration: none;
        color: #0000FF;
}
a:hover {
        text-decoration: none;
        color: #000000;
}
a:active {
        text-decoration: none;
        color: #FFFFFF;
}
.style1 {color: #FFFFFF}
-->
</style></head>

<body>
<div align="center">
  <table width="100" border="0" cellpadding="0">
    <tr>
      <td colspan="2"><img src="banner-admin.jpg" width="961" height="208"></td>
    </tr>
    <tr>
      <td width="206" align="center" valign="top" bgcolor="#000099"><table width="206" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="258" align="center" bgcolor="#000000"><span class="style1"><strong>Menu</strong></span></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><a href="kategori/kategori.php"><span class="style1">- Kategori</span></a></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><a href="produk/produk.php"><span class="style1">- Produk</span></a></td>
        </tr>
        <tr>
          <script language="javascript">
<!--
function logout()
{
        tanya=confirm("Apakah anda yakin akan keluar ?")
        if (tanya !="0")
        {
                        top.location="logout.php"
        }
}
//-->
</script>
  <td bgcolor="#000048"><span class="style1"><a href="#"onClick="logout()"><strong>- Logout</strong></a></span></td>
        </tr>
      </table></td>
      <td width="753" height="250" align="center" bgcolor="#FFFFFF">SELAMAT DATANG DI HALAMAN ADMINISTRATOR</td>
    </tr>
    <tr align="center" valign="middle" bgcolor="#000099">
      <td colspan="2"></td>
    </tr>
  </table>
</div>
</body>
</html>
<?php

}else{
  echo "<script language='javascript'>alert('Silakan Login Terlebih Dahulu')</script>";
 echo"<script language='javascript'>window.location = 'index.php'</script>";
}
?>


3.       3. Kategori_produk.php
<?php session_start(); ?>
<?php if (!empty($_SESSION['usernameku']) && !empty($_SESSION['passwordku'])) { ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>halaman admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
 <link rel="stylesheet" href="style.css">


 <script type="text/javascript" src="jquery.js"></script>

<style type="text/css">
<!--
body {
        background-color: #000033;
}
a:link {
        color: #0000FF;
        text-decoration: none;
}
a:visited {
        text-decoration: none;
        color: #0000FF;
}
a:hover {
        text-decoration: none;
        color: #000000;
}
a:active {
        text-decoration: none;
        color: #FFFFFF;
}
.style1 {color: #FFFFFF}
-->
</style></head>

<body>
<div align="center">
  <table width="100" border="0" cellpadding="0">
    <tr>
      <td colspan="2"><img src="../banner-admin.jpg" width="961" height="208"></td>
    </tr>
    <tr>
      <td width="206" align="center" valign="top" bgcolor="#000099"><table width="206" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="258" align="center" bgcolor="#000000"><span class="style1"><strong>Menu</strong></span></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><a href="kategori.php"><span class="style1">- Kategori</span></a></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><a href="../produk/produk.php"><span class="style1">- Produk</span></a></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><span class="style1">- Kota </span></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><span class="style1">- Ongkos Kirim </span></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><span class="style1">- Contact Us </span></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><span class="style1">- Cara Belanja</span></td>
        </tr>
        <tr>
          <script language="javascript">
<!--
function logout()
{
        tanya=confirm("Apakah anda yakin akan keluar ?")
        if (tanya !="0")
        {
                        top.location="../logout.php"
        }
}
//-->
</script>
<td bgcolor="#000048"><span class="style1"><a href="#"onClick="logout()"><strong>- Logout</strong></a></span></td>
       
        </tr>
      </table></td>
      <td width="753" height="250" align="left" bgcolor="#FFFFFF"><div align="center">KATEGORI PRODUK
        </div>
        <table width="755" border="0">
        <tr>
          <td width="27">&nbsp;</td>
          <td width="702">&nbsp;</td>
          <td width="10">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><p align="left"><a href="input_kategori.php">+ Tambah Produk </a></p>
            <p>
              <?php
include "../koneksi.php";

$query = "select * from kategori where 1";
$sql = mysql_query($query);

?>
            <table border="0">
              <tr bgcolor="#B0B0B0">
                <th><small>NO</small></th>
                <th><small>KATEGORI</small></th>
                <th><small>AKSI</small></th>
              </tr>
              <?php
$no=1;
while ($data=mysql_fetch_array($sql))
{
?>
              <tr bgcolor="#E4E4E4">
                <td><small><?php echo $no?></small></td>
                <td><small><?php echo $data['nama_kategori']; ?></small></td>
                <td><small><a href="hapus_kategori.php?id=<?php echo $data['id_kategori']; ?>"
        onClick = "return confirm('Apakah Anda ingin mengapus data <?php echo $data['id_kategori']; ?>?')"> Hapus </a> | <a href="edit_kategori.php?id=<?php echo $data['id_kategori']; ?>" >Edit</a> </small></td>
              </tr>
              <?php
$no++;
}
?>
            </table>
            <p></p></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    </tr>
    <tr align="center" valign="middle" bgcolor="#000099">
      <td colspan="2"></td>
    </tr>
  </table>
</div>
</body>
</html>
<?php

}else{
  echo "<script language='javascript'>alert('Silakan Login Terlebih Dahulu')</script>";
 echo"<script language='javascript'>window.location = 'index.php'</script>";
}
?>




4.       4. Edit_kategori.php
<?php session_start(); ?>
<?php if (!empty($_SESSION['usernameku']) && !empty($_SESSION['passwordku'])) { ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>halaman admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
                background-color: #000033;
}
a:link {
                color: #0000FF;
                text-decoration: none;
}
a:visited {
                text-decoration: none;
                color: #0000FF;
}
a:hover {
                text-decoration: none;
                color: #000000;
}
a:active {
                text-decoration: none;
                color: #FFFFFF;
}
.style1 {color: #FFFFFF}
-->
</style></head>

<body>
<div align="center">
  <table width="100" border="0" cellpadding="0">
    <tr>
      <td colspan="2"><img src="../banner-admin.jpg" width="961" height="208"></td>
    </tr>
    <tr>
      <td width="206" align="center" valign="top" bgcolor="#000099"><table width="206" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="258" align="center" bgcolor="#000000"><span class="style1"><strong>Menu</strong></span></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><a href="kategori.php"><span class="style1">- Kategori</span></a></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><a href="../produk/produk.php"><span class="style1">- Produk</span></a></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><span class="style1">- Kota </span></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><span class="style1">- Ongkos Kirim </span></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><span class="style1">- Contact Us </span></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><span class="style1">- Cara Belanja</span></td>
        </tr>
        <tr>
          <script language="javascript">
<!--
function logout()
{
                tanya=confirm("Apakah anda yakin akan keluar ?")
                if (tanya !="0")
                {
                                top.location="../logout.php"
                }
}
//-->
</script>
<td bgcolor="#000048"><span class="style1"><a href="#"onClick="logout()"><strong>- Logout</strong></a></span></td>
       
        </tr>
      </table></td>
      <td width="753" height="250" align="left" bgcolor="#FFFFFF"><div align="center">INPUT KATEGORI PRODUK
        </div>
        <table width="755" border="0">
        <tr>
          <td width="27">&nbsp;</td>
          <td width="702">&nbsp;</td>
          <td width="10">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><p align="left"><form enctype="multipart/form-data" method="post" action="update_kategori.php?&id=<?php echo $_GET['id'] ?>">
    <table border="0">
      <?php
  include "../koneksi.php";
 
  $id                        = $_GET['id'];
  $edit                   = "select * from kategori where id_kategori=$id";
  $hasil  = mysql_query ($edit);
  $c                         = mysql_fetch_array ($hasil);
  ?>
      <tr>
        <td width="144"><small>KATEGORI </small></td>
        </tr>
      <tr>
        <td><input name="kategori" type="text" id="kategori"  value="<?php echo $c['nama_kategori']?>"></td>
        </tr>
      <tr>
        <td align="right"><input type="submit" name="submit" value="simpan"></td>
        </tr>
    </table>
  </form>
            </p>
<p></p></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    </tr>
    <tr align="center" valign="middle" bgcolor="#000099">
      <td colspan="2"></td>
    </tr>
  </table>
</div>
</body>
</html>
<?php

}else{
  echo "<script language='javascript'>alert('Silakan Login Terlebih Dahulu')</script>";
 echo"<script language='javascript'>window.location = 'index.php'</script>";
}
?>



5.       5. Input_kategori.php
<?php session_start(); ?>
<?php if (!empty($_SESSION['usernameku']) && !empty($_SESSION['passwordku'])) { ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>halaman admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
                background-color: #000033;
}
a:link {
                text-decoration: none;
}
a:visited {
                text-decoration: none;
}
a:hover {
                text-decoration: none;
}
a:active {
                text-decoration: none;
}
.style1 {color: #FFFFFF}
-->
</style></head>

<body>
<div align="center">
  <table width="100" border="0" cellpadding="0">
    <tr>
      <td colspan="2"><img src="../banner-admin.jpg" width="961" height="208"></td>
    </tr>
    <tr>
      <td width="206" align="center" valign="top" bgcolor="#000099"><table width="206" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="258" align="center" bgcolor="#000000"><span class="style1"><strong>Menu</strong></span></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><a href="kategori.php"><span class="style1">- Kategori</span></a></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><a href="../produk/produk.php"><span class="style1">- Produk</span></a></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><span class="style1">- Kota </span></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><span class="style1">- Ongkos Kirim </span></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><span class="style1">- Contact Us </span></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><span class="style1">- Cara Belanja</span></td>
        </tr>
        <tr>
         <script language="javascript">
<!--
function logout()
{
                tanya=confirm("Apakah anda yakin akan keluar ?")
                if (tanya !="0")
                {
                                top.location="../logout.php"
                }
}
//-->
</script>
<td bgcolor="#000048"><span class="style1"><a href="#"onClick="logout()"><strong>- Logout</strong></a></span></td>
       
        </tr>
      </table></td>
      <td width="753" height="250" align="left" bgcolor="#FFFFFF"><div align="center">INPUT KATEGORI PRODUK
        </div>
        <table width="755" border="0">
        <tr>
          <td width="27">&nbsp;</td>
          <td width="702">&nbsp;</td>
          <td width="10">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><p align="left"><form method="post" action="proses_kategori.php">
        <table border="0" cellpadding="0">
          <tr bgcolor="#999999">
            <td><small><strong>KATEGORI</strong></small></td>
          </tr>
          <tr bgcolor="#CCCCCC">
            <td><input name="kategori" type="text" id="kategori"></td>
          </tr>
          <tr bgcolor="#CCCCCC">
            <td align="right"><input type="submit" value="submit" name="simpan"></td>
          </tr>
        </table>
                                </form></p>
            <p></p></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    </tr>
    <tr align="center" valign="middle" bgcolor="#000099">
      <td colspan="2"></td>
    </tr>
  </table>
</div>
</body>
</html>
<?php

}else{
  echo "<script language='javascript'>alert('Silakan Login Terlebih Dahulu')</script>";
 echo"<script language='javascript'>window.location = 'index.php'</script>";
}
?>

6.       Update_kategori
<?php
include "../koneksi.php";



extract($_POST);
if (empty ($kategori))
{
echo "<script>alert('data tidak boleh kosong');
document.location.href='kategori.php'; </script>\n"; exit ;
}
$q=mysql_query("UPDATE kategori SET
                                                                                                                                       
                                   
                                    nama_kategori                                                  = '$_POST[kategori]'
                                   WHERE id_kategori                         = '$_GET[id]'");
                                                                                                                                       
                                                                                                                                       

if($q){          

echo"<script>alert('data berhasil di update...');
document.location.href='kategori.php'; </script>\n";

} else {
echo"<script>alert('gagal di update');
document.location.href='kategori.php'; </script>\n";
}
?>
7.       Hapus_kategori.php

<?php
include "../koneksi.php";
?>

<?php

$id_kategori  = $_GET['id'];


$query = mysql_query("delete from kategori where id_kategori='$id_kategori'");

if ($query){
echo"<script>alert('data berhasil di hapus...');
document.location.href='kategori.php'; </script>\n";
}
else
{echo"<script>alert('hapus gagal');
document.location.href='kategori.php'; </script>\n";}


?>

8.       Proses_kategori.php
<?php
include "../koneksi.php";

$kategori                             = $_POST['kategori'];

if (empty ($kategori))
{
echo "<script>alert('data tidak boleh kosong');
document.location.href='input_kategori.php'; </script>\n"; exit ;
}

$query = mysql_query ('insert into kategori (nama_kategori)values("'.$kategori.'")');

if($query) {
echo "<script>alert('data berhasil disimpan');
document.location.href='kategori.php'; </script>\n";
}else{
echo "<script>alert('data gagal disimpan');
document.location.href='input_kategori.php'; </script>\n";
}
?>


9.       6. Edit_produk.php
<?php session_start(); ?>
<?php if (!empty($_SESSION['usernameku']) && !empty($_SESSION['passwordku'])) { ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>halaman admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
        background-color: #000033;
}
a:link {
        color: #0000FF;
        text-decoration: none;
}
a:visited {
        text-decoration: none;
        color: #0000FF;
}
a:hover {
        text-decoration: none;
        color: #000000;
}
a:active {
        text-decoration: none;
        color: #FFFFFF;
}
.style1 {color: #FFFFFF}
-->
</style></head>

<body>
<div align="center">
  <table width="100" border="0" cellpadding="0">
    <tr>
      <td colspan="2"><img src="../banner-admin.jpg" width="961" height="208"></td>
    </tr>
    <tr>
      <td width="206" align="center" valign="top" bgcolor="#000099"><table width="206" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="258" align="center" bgcolor="#000000"><span class="style1"><strong>Menu</strong></span></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><a href="../kategori/kategori.php"><span class="style1">- Kategori</span></a></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><a href="produk.php"><span class="style1">- Produk</span></a></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><span class="style1">- Kota </span></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><span class="style1">- Ongkos Kirim </span></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><span class="style1">- Contact Us </span></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><span class="style1">- Cara Belanja</span></td>
        </tr>
        <tr>
           <script language="javascript">
<!--
function logout()
{
        tanya=confirm("Apakah anda yakin akan keluar ?")
        if (tanya !="0")
        {
                        top.location="../logout.php"
        }
}
//-->
</script>
<td bgcolor="#000048"><span class="style1"><a href="#"onClick="logout()"><strong>- Logout</strong></a></span></td>

        </tr>
      </table></td>
      <td width="753" height="250" align="left" bgcolor="#FFFFFF"><div align="center">INPUT KATEGORI PRODUK
        </div>
        <table width="755" border="0">
          <tr>
            <td width="27">&nbsp;</td>
            <td width="702">&nbsp;</td>
            <td width="10">&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><p align="left">       
                <form enctype="multipart/form-data" method="post" action="update_produk.php?&id=<?php echo $_GET['id'] ?>">
                  <table width="383" border="0">
                    <?php
include'../koneksi.php';

$id = $_GET[id];
$edit                              = "select * from produk where id_produk=$id";
  $hasil          = mysql_query ($edit);
  $c                 = mysql_fetch_array ($hasil);

?>
<?php
include'../koneksi.php';
$sql_kategori="select * from kategori order by id_kategori";
$kueri_kategori=mysql_query($sql_kategori) or die(mysql_error());


?>
                    <tr>
                      <td width="92"><small><strong>Kategori</strong></small></td>
                      <td width="10">:</td>
                      <td width="267"><select name="kategori">
                          <?php
 while (list($kode,$nama_status)=mysql_fetch_array($kueri_kategori))
   {
?>
                          <option  value="<?php echo $kode ?>"><?php echo $nama_status ?></option>
                          <?php
  }
?>
                      </select></td>
                    </tr>
                    <tr>
                      <td><small><strong>Nama Produk </strong></small></td>
                      <td>:</td>
                      <td><input type="text" name="produk" value="<?php echo $c['nama_produk']; ?>"></td>
                    </tr>
                    <tr>
                      <td><small><strong>Deskripsi</strong></small></td>
                      <td>:</td>
                      <td><textarea name="deskripsi" id="deskripsi"></textarea></td>
                    </tr>
                    <tr>
                      <td><small><strong>Harga</strong></small></td>
                      <td>:</td>
                      <td><input name="harga" type="text" id="harga" size="7" value="<?php echo $c['harga']; ?>">
              Rupiah </td>
                    </tr>
                    <tr>
                      <td><small><strong>Stock</strong></small></td>
                      <td>:</td>
                      <td><input name="stock" type="text" id="stock" value="<?php echo $c['stock']; ?>"></td>
                    </tr>
                    <tr>
                      <td><small><strong>Berat</strong></small></td>
                      <td>:</td>
                      <td><input name="berat" type="text" id="berat" size="5" value="<?php echo $c['berat']; ?>">
              kg</td>
                    </tr>
                    <tr>
                      <td><small><strong>Dibeli</strong></small></td>
                      <td>:</td>
                      <td><input name="dibeli" type="text" id="dibeli" value="<?php echo $c['dibeli']; ?>"></td>
                    </tr>
                    <tr>
                      <td><small><strong>Gambar</strong></small></td>
                      <td>:</td>
                      <td><input type="file" name="fupload" id="nama_file" value="<?php echo $c['gambar']; ?>"></td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td><input type="submit" name="Submit" value="Submit"></td>
                    </tr>
                  </table>
                </form>
                <p></p>
                <p></p></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table></td>
    </tr>
    <tr align="center" valign="middle" bgcolor="#000099">
      <td colspan="2"><span class="style1">
    </tr>
  </table>
</div>
</body>
</html>
<?php

}else{
  echo "<script language='javascript'>alert('Silakan Login Terlebih Dahulu')</script>";
 echo"<script language='javascript'>window.location = 'index.php'</script>";
}
?>



10.   Hapus_produk.php

<?php
include "../koneksi.php";
?>

<?php

$id_produk  = $_GET['id'];
$foto                     = $_GET['filenya'];


if ($foto=="")
{
$query = mysql_query("delete from produk where id_produk='$id_produk'");

} else {
$query = mysql_query("delete from produk where gambar='$foto'");
unlink("produk/foto/$_GET[filenya]");
}


if ($query){
echo"<script>alert('data berhasil di hapus...');
document.location.href='produk.php'; </script>\n";
}
else
{echo"<script>alert('hapus gagal');
document.location.href='produk.php'; </script>\n";}


?>



111.   Input_produk.php
<?php session_start(); ?>
<?php if (!empty($_SESSION['usernameku']) && !empty($_SESSION['passwordku'])) { ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>halaman admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
                background-color: #000033;
}
a:link {
                color: #0000FF;
                text-decoration: none;
}
a:visited {
                text-decoration: none;
                color: #0000FF;
}
a:hover {
                text-decoration: none;
                color: #000000;
}
a:active {
                text-decoration: none;
                color: #FFFFFF;
}
.style1 {color: #FFFFFF}
-->
</style></head>

<body>
<div align="center">
  <table width="100" border="0" cellpadding="0">
    <tr>
      <td colspan="2"><img src="../banner-admin.jpg" width="961" height="208"></td>
    </tr>
    <tr>
      <td width="206" align="center" valign="top" bgcolor="#000099"><table width="206" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="258" align="center" bgcolor="#000000"><span class="style1"><strong>Menu</strong></span></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><a href="../kategori/kategori.php"><span class="style1">- Kategori</span></a></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><a href="produk.php"><span class="style1">- Produk</span></a></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><span class="style1">- Kota </span></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><span class="style1">- Ongkos Kirim </span></td>
        </tr>
        <tr>
          <td bgcolor="#000048"><span class="style1">- Contact Us </span></td>
        </tr>
        <tr>
          <td bgcolor="#00006A"><span class="style1">- Cara Belanja</span></td>
        </tr>
        <tr>
          <script language="javascript">
<!--
function logout()
{
                tanya=confirm("Apakah anda yakin akan keluar ?")
                if (tanya !="0")
                {
                                top.location="../logout.php"
                }
}
//-->
</script>
<td bgcolor="#000048"><span class="style1"><a href="#"onClick="logout()"><strong>- Logout</strong></a></span></td>

        </tr>
      </table></td>
      <td width="753" height="250" align="left" bgcolor="#FFFFFF"><div align="center">INPUT  PRODUK
        </div>
        <table width="755" border="0">
        <tr>
          <td width="27">&nbsp;</td>
          <td width="702">&nbsp;</td>
          <td width="10">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><p align="left"><form action="proses_produk.php" method="post" enctype="multipart/form-data">
        <table width="383" border="0">
<?php
include'../koneksi.php';
$sql_kategori="select * from kategori order by id_kategori";
$kueri_kategori=mysql_query($sql_kategori) or die(mysql_error());


?>
          <tr>
            <td width="92"><small><strong>Kategori</strong></small></td>
            <td width="10">:</td>
            <td width="267"><select name="kategori">
              <?php
 while (list($kode,$nama_status)=mysql_fetch_array($kueri_kategori))
   {
?>
              <option  value="<?php echo $kode ?>"><?php echo $nama_status ?></option>
              <?php
  }
?>
            </select></td>
          </tr>
          <tr>
            <td><small><strong>Nama Produk </strong></small></td>
            <td>:</td>
            <td><input type="text" name="produk"></td>
          </tr>
          <tr>
            <td><small><strong>Deskripsi</strong></small></td>
            <td>:</td>
            <td><textarea name="deskripsi" id="deskripsi"></textarea></td>
          </tr>
          <tr>
            <td><small><strong>Harga</strong></small></td>
            <td>:</td>
            <td><input name="harga" type="text" id="harga" size="7">
              Rupiah </td>
          </tr>
          <tr>
            <td><small><strong>Stock</strong></small></td>
            <td>:</td>
            <td><input name="stock" type="text" id="stock"></td>
          </tr>
          <tr>
            <td><small><strong>Berat</strong></small></td>
            <td>:</td>
            <td><input name="berat" type="text" id="berat" size="5">
            kg</td>
          </tr>
          <tr>
            <td><small><strong>Dibeli</strong></small></td>
            <td>:</td>
            <td><input name="dibeli" type="text" id="dibeli"></td>
          </tr>
          <tr>
            <td><small><strong>Gambar</strong></small></td>
            <td>:</td>
            <td><input type="file" name="fupload" id="nama_file"></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit" value="Submit"></td>
          </tr>
        </table>
          </form></p>
            <p></p></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    </tr>
    <tr align="center" valign="middle" bgcolor="#000099">
      <td colspan="2"></td>
    </tr>
  </table>
</div>
</body>
</html>
<?php

}else{
  echo "<script language='javascript'>alert('Silakan Login Terlebih Dahulu')</script>";
 echo"<script language='javascript'>window.location = 'index.php'</script>";
}
?>

12.   Proses_produk.php
<?php
include "../koneksi.php";
include"../config/fungsi_gambar.php";

$lokasi_file = $_FILES['fupload']['tmp_name'];
$nama_file   = $_FILES['fupload']['name'];


$kategori                             = $_POST['kategori'];
$produk                                               = $_POST['produk'];
$deskripsi                           = $_POST['deskripsi'];
$harga                                  = $_POST['harga'];
$stock                                   = $_POST['stock'];
$berat                                   = $_POST['berat'];
$dibeli                                  = $_POST['dibeli'];

if (empty ($kategori) or empty ($produk) or empty($deskripsi) or empty($harga) or empty($stock) or empty ($berat) or empty ($dibeli))
{
echo "<script>alert('data tidak boleh kosong');
document.location.href='input_produk.php'; </script>\n"; exit ;
}


if (!empty($lokasi_file))
   {
    UploadFile($nama_file);

$query = mysql_query ('insert into produk (kategori,nama_produk,deskripsi,harga,stock,berat,tgl_masuk,dibeli,gambar)values("'.$kategori.'","'.$produk.'","'.$deskripsi.'","'.$harga.'","'.$stock.'","'.$berat.'","'.date('Y-m-d').'","'.$dibeli.'","'.$nama_file.'")');
} else {
$query=mysql_query('insert into produk (kategori,nama_produk,deskripsi,harga,stock,berat,tgl_masuk,dibeli) values("'.$kategori.'","'.$produk.'","'.$deskripsi.'","'.$harga.'","'.$stock.'","'.$berat.'","'.date('Y-m-d').'","'.$dibeli.'")');
}

if($query) {
echo "<script>alert('data berhasil disimpan');
document.location.href='produk.php'; </script>\n";
}else{
echo "<script>alert('data gagal disimpan');
document.location.href='input_produk.php'; </script>\n";
}
?>

13.   Update_produk.php
<?php
include "../koneksi.php";
include"../config/fungsi_gambar.php";




extract($_POST);
?>

<?php
$lokasi_file = $_FILES['fupload']['tmp_name'];
$nama_file   = $_FILES['fupload']['name'];

 
    // Apabila ada gambar yang diupload
   if (empty($lokasi_file)){
  
    $q=mysql_query("UPDATE produk SET
                                                                                                                                               
                                    kategori                                      = '$_POST[kategori]',
                                    nama_produk                                           = '$_POST[produk]',
                                    deskripsi                                    = '$_POST[deskripsi]',
                                    harga                                            = '$_POST[harga]',
                                    stock                                                             = '$_POST[stock]',
                                    berat                                                             = '$_POST[berat]',
                                    dibeli                                                           = '$_POST[dibeli]'
                                    WHERE id_produk                   = '$_GET[id]'");
 }
  else{
    UploadFile($nama_file);
  
    $q=mysql_query("UPDATE produk SET
                                                                                                                                                 kategori                                             = '$_POST[kategori]',
                                    nama_produk                                           = '$_POST[produk]',
                                    deskripsi                                    = '$_POST[deskripsi]',
                                    harga                                            = '$_POST[harga]',
                                    stock                                                             = '$_POST[stock]',
                                    berat                                                             = '$_POST[berat]',
                                    dibeli                                                           = '$_POST[dibeli]',
                                    gambar                                                        = '$nama_file'
                                    WHERE id_produk                   = '$_GET[id]'");
                                }
if($q){  

echo"<script>alert('data berhasil di update...');
document.location.href='produk.php'; </script>\n";

} else {
echo"<script>alert('gagal di update');
document.location.href='produk.php'; </script>\n";
}
?>











========================== HALAMAN USER ========================== 



  


1. Index.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
 <link rel="stylesheet" href="style.css">

 <script type="text/javascript" src="jquery.js"></script>

<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900" rel="stylesheet" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />

<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]-->

<style type="text/css">
.kotak {
height:250px;
width : 180px;
padding:10px;
background-color:#ffffff;
width:250px;
margin-top:10px; }

.sub-barang{
text-align:center;
padding:5px;
width:210px;
float:left;
border:1px dashed #333333;
                -moz-border-radius:4px;
                -khtml-border-radius: 4px;
                -webkit-border-radius: 4px;
                margin:5px 5px 10px 5px;
}
.jdl-brg{
font-size:14px;
height:200px;
margin-bottom:70px;
font-family:"Comic Sans MS";
}

#paging{
width:1154px;
margin-top:600px;
height:42px;
border:1px dashed #666666;
                -moz-border-radius:4px;
                -khtml-border-radius: 4px;
                -webkit-border-radius: 4px;
}
#kotak-paging{
text-align:center;
margin:5px;
padding:5px;
width:50px;
float:left;
border:1px dashed #666666;
                -moz-border-radius:4px;
                -khtml-border-radius: 4px;
                -webkit-border-radius: 4px;
}


</style>

<style type="text/css">
img {
padding:5px;
background-color:000066;
border-radius:20px;
}
</style>

<style type="text/css">
<!--
.style9 {                color: #FF0000;
                font-size: 18pt;
}
-->
</style>
</head>
<body>
<div id="header" class="container">
  <div id="logo">
    <h1><a href="#">HFShop</a></h1>
  </div>
  <div id="menu">
                                <ul>
                                                <li class="active"><a href="index.php" accesskey="1" title=""><span class="glyphicon glyphicon-home"></span> Home</a></li>
                                                <li><a href="aboutus.php" accesskey="3" title=""><span class="glyphicon glyphicon-user"></span> Tentang</li>
                                                <li><a href="carabelanja.php" accesskey="4" title=""><span class="glyphicon glyphicon-shopping-cart"></span> &nbsp;cara belanja</a></li>
                                                <li><a href="contactus.php" accesskey="5" title=""><span class="glyphicon glyphicon-earphone"></span> &nbsp;Kontak</a></li>
                                </ul>
                </div>
                <p>&nbsp;</p>
</div>



<div id="banner"></div>

<div id="page" class="container">
      <?php 
    include "koneksi.php"; 
  
$batas=10;
$paging=$_GET['paging'];
if(empty($paging))
                {
                $posisi=0;
                $paging=1;
                }

else{
                $posisi=($paging-1) * $batas;
                }
$query=mysql_query("select * from produk order by id_produk desc limit $posisi,$batas");
while($r=mysql_fetch_array($query))
{
    echo"<div class='sub-barang'><div class='jdl-brg'><div class='jdl-brg'><img border=2 src='../ngadimin/produk/foto/$r[gambar]' border=0 width=200 height=200>
       
                                <strong>$r[2]</strong>
     
        Rp$r[4] <br><a href='detail.php?id=$r[id_produk]&filenya=$r[gambar]' ><img src='images/detailButton.gif'></a></div></div></div> ";
     
    }
//penomoran
echo "<tr><td colspan='2' valign='top' align='center'>";
$query2=mysql_query("select * from produk");
$jumlah_data=mysql_num_rows($query2);
$jumlah_halaman=ceil($jumlah_data/$batas);
echo"<div id='paging'>";
if (1 != $paging){//tanda != berarti perintah akan dijalankan jika $paging tidak sama dengan 1, copyright all teknik paging by go_blind_hacker, powered by V-boys_studio
                $back=$paging-1;
                echo "<div id='kotak-paging'><a href='index.php?paging=$back'><b>Back</b></a></div>";
                }
                else{
                echo"<div id='kotak-paging'>Back</div>";
                }
               
if ($paging != $jumlah_halaman){
                $next=$paging+1;
                echo" <div id='kotak-paging'><a href='index.php?paging=$next'>  <b>Next</b></a></div>";
                }
                else
                {
                echo "<div id='kotak-paging'>Next</div>";
                }
echo"</div>";
?>
    </tr>
  </table>
</div>
<p class="style9">PARTNER KAMI </p>
<table width="875" border="0" align="center">
  <tr>
    <td align="center"><img src="images/cek-kiriman-paket-barang-TIKI.jpg" width="150" height="100" /><img src="images/TIKI-JNE.gif" width="150" height="100" /><img src="images/bank-mandiri-logo11.jpg" width="150" height="100" /><img src="images/248_logo.jpg" width="200" height="100" /></td>
  </tr>
</table>
<p>&nbsp;</p>
<div id="copyright" class="container">
                <p>Copyright (c) 2017<a href="index.php" rel="nofollow">HFShop</a>.</p>
</div>
</body>
</html>



2. Aboutus.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Name       : PlainLeaf
Description: A two-column, fixed-width design with dark color scheme.
Version    : 1.0
Released   : 20130902

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
 <link rel="stylesheet" href="style.css">

 <script type="text/javascript" src="jquery.js"></script>
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900" rel="stylesheet" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />

<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]-->

<style type="text/css">
<!--
.style5 {
                color: #0000FF;
                font-size: 16pt;
}
.style7 {color: #0000FF; font-size: 14pt; font-weight: bold; }
.style8 {
                color: #00CC00;
                font-size: 14pt;
                font-weight: bold;
}
.style9 {
                color: #FF0000;
                font-size: 18pt;
}
-->
</style>
</head>
<body>
<div id="header" class="container">
  <div id="logo">
    <h1><a href="#">HFShop</a></h1>
  </div>
  <div id="menu">
                                <ul>
                                                <li class="active"><a href="index.php" accesskey="1" title=""><span class="glyphicon glyphicon-home"></span> Home</a></li>
                                                <li><a href="aboutus.php" accesskey="3" title=""><span class="glyphicon glyphicon-user"></span> Tentang</li>
                                                <li><a href="carabelanja.php" accesskey="4" title=""><span class="glyphicon glyphicon-shopping-cart"></span> &nbsp;cara belanja</a></li>
                                                <li><a href="contactus.php" accesskey="5" title=""><span class="glyphicon glyphicon-earphone"></span> &nbsp;Kontak</a></li>
                                </ul>
                </div>
                <p>&nbsp;</p>
</div>
<div id="banner"></div>
<div id="page" class="container">
  <p>Kami adalah situs jual beli online  yang harganya cukup murah. letak toko asli kami adalah di Perum Asabri Bumi Kiara Indah dengan nama toko HFShop. dalam melakukan jual beli, kami memberikan harga semurah-urahnya kepada customer untuk produk yang cukup baik. karena jika anda puas belanja di toko kami, maka kebanggan besar untuk kami.terima kasih telah mengunjungi situs kami. selamat berbelanja. <span class="style8">.::'HFShop'::..</span></p>
  <p class="style9">PARTNER KAMI </p>
  <table width="875" border="0" align="center">
    <tr>
      <td align="center"><img src="images/cek-kiriman-paket-barang-TIKI.jpg" width="150" height="100" /><img src="images/TIKI-JNE.gif" width="150" height="100" /><img src="images/bank-mandiri-logo11.jpg" width="150" height="100" /><img src="images/248_logo.jpg" width="200" height="100" /></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</div>
<p>&nbsp;</p>
<div id="copyright" class="container">
                <p>Copyright (c) 2017 |<a href="index.php" rel="nofollow">Hanif Rivaldi </a>.</p>
</div>
</body>
</html>




3. Carabelanja.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Name       : PlainLeaf
Description: A two-column, fixed-width design with dark color scheme.
Version    : 1.0
Released   : 20130902

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
 <link rel="stylesheet" href="style.css">


 <script type="text/javascript" src="jquery.js"></script>

<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900" rel="stylesheet" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />

<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]-->

<style type="text/css">
<!--
.style5 {
                color: #0000FF;
                font-size: 16pt;
}
.style7 {color: #0000FF; font-size: 14pt; font-weight: bold; }
.style8 {
                color: #00CC00;
                font-size: 14pt;
                font-weight: bold;
}
.style9 {
                color: #FF0000;
                font-size: 18pt;
}
-->
</style>
</head>
<body>
<div id="header" class="container">
  <div id="logo">
    <h1><a href="#">HFShop</a></h1>
  </div>
  <div id="menu">
                                <ul>
        <li class="active"><a href="index.php" accesskey="1" title=""><span class="glyphicon glyphicon-home"></span> Home</a></li>
                                                <li><a href="aboutus.php" accesskey="3" title=""><span class="glyphicon glyphicon-user"></span> Tentang</li>
                                                <li><a href="carabelanja.php" accesskey="4" title=""><span class="glyphicon glyphicon-shopping-cart"></span> &nbsp;cara belanja</a></li>
                                                <li><a href="contactus.php" accesskey="5" title=""><span class="glyphicon glyphicon-earphone"></span> &nbsp;Kontak</a></ul>
  </div>
</div>
<div id="banner"></div>
<div id="page" class="container">
  <p>untuk berbelanja di toko kami sangat mudah. anda hanya melihat barang yang tersedia pada tampilan produk. setelah itu anda terima kasih telah mengunjungi situs kami. selamat berbelanja. <span class="style8">.::'HFShop'::..</span></p>
  <p class="style9">PARTNER KAMI </p>
  <table width="875" border="0" align="center">
    <tr>
      <td align="center"><img src="images/cek-kiriman-paket-barang-TIKI.jpg" width="150" height="100" /><img src="images/TIKI-JNE.gif" width="150" height="100" /><img src="images/bank-mandiri-logo11.jpg" width="150" height="100" /><img src="images/248_logo.jpg" width="200" height="100" /></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</div>
<p>&nbsp;</p>
<div id="copyright" class="container">
                <p>Copyright (c) 2017<a href="index.php" rel="nofollow">HFShop</a>.</p>

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



4. contactus.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Name       : PlainLeaf
Description: A two-column, fixed-width design with dark color scheme.
Version    : 1.0
Released   : 20130902

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
 <link rel="stylesheet" href="style.css">


 <script type="text/javascript" src="jquery.js"></script>

<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900" rel="stylesheet" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />

<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]-->

<style type="text/css">
<!--
.style5 {
                color: #0000FF;
                font-size: 16pt;
}
.style7 {color: #0000FF; font-size: 14pt; font-weight: bold; }
.style8 {
                color: #00CC00;
                font-size: 14pt;
                font-weight: bold;
}
.style9 {
                color: #FF0000;
                font-size: 18pt;
}
-->
</style>
</head>
<body>
<div id="header" class="container">
  <div id="logo">
    <h1><a href="#">HFShop</a></h1>
  </div>
  <div id="menu">
                                <ul>
                                                <li class="active"><a href="index.php" accesskey="1" title=""><span class="glyphicon glyphicon-home"></span> Home</a></li>
                                                <li><a href="aboutus.php" accesskey="3" title=""><span class="glyphicon glyphicon-user"></span> Tentang</li>
                                                <li><a href="carabelanja.php" accesskey="4" title=""><span class="glyphicon glyphicon-shopping-cart"></span> &nbsp;cara belanja</a></li>
                                                <li><a href="contactus.php" accesskey="5" title=""><span class="glyphicon glyphicon-earphone"></span> &nbsp;Kontak</a></li>  </ul>
  </div>
</div>
<div id="banner"></div>
<div id="page" class="container">
  <p><br>.terima kasih telah mengunjungi situs kami. selamat berbelanja. <span class="style8">.::'HFShop'::..</span></p>
  <p class="style9">PARTNER KAMI </p>
  <table width="875" border="0" align="center">
    <tr>
      <td align="center"><img src="images/cek-kiriman-paket-barang-TIKI.jpg" width="150" height="100" /><img src="images/TIKI-JNE.gif" width="150" height="100" /><img src="images/bank-mandiri-logo11.jpg" width="150" height="100" /><img src="images/248_logo.jpg" width="200" height="100" /></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</div>
<p>&nbsp;</p>
<div id="copyright" class="container">
                <p>Copyright (c) 2017<a href="index.php" rel="nofollow">HFShop</a>.</p>
</div>
</body>
</html>




5. detail.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
 <link rel="stylesheet" href="style.css">

 <script type="text/javascript" src="jquery.js"></script>

<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900" rel="stylesheet" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />

<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]-->

<style type="text/css">
.kotak {
height:250px;
width : 180px;
padding:10px;
background-color:#ffffff;
width:250px;
margin-top:10px; }

.sub-barang{
text-align:center;
padding:5px;
width:210px;
float:left;
border:1px dashed #333333;
                -moz-border-radius:4px;
                -khtml-border-radius: 4px;
                -webkit-border-radius: 4px;
                margin:5px 5px 10px 5px;
}
.jdl-brg{
font-size:14px;
height:200px;
margin-bottom:70px;
font-family:"Comic Sans MS";
}

</style>

<style type="text/css">
img {
padding:5px;
background-color:000066;
border-radius:20px;
}
</style>

<style type="text/css">
<!--
.style9 {                color: #FF0000;
                font-size: 18pt;
}
.style10 {
                color: #8dc63f;
                font-weight: bold;
}
-->
</style>
</head>
</head>
<body>
<div id="header" class="container">
  <div id="logo">
    <h1><a href="#">HFShop</a></h1>
  </div>
  <div id="menu">
                                <ul>
                                                <li class="active"><a href="index.php" accesskey="1" title=""><span class="glyphicon glyphicon-home"></span> Home</a></li>
                                                <li><a href="aboutus.php" accesskey="3" title=""><span class="glyphicon glyphicon-user"></span> Tentang</li>
                                                <li><a href="carabelanja.php" accesskey="4" title=""><span class="glyphicon glyphicon-shopping-cart"></span> &nbsp;cara belanja</a></li>
                                                <li><a href="contactus.php" accesskey="5" title=""><span class="glyphicon glyphicon-earphone"></span> &nbsp;Kontak</a></li>
                                </ul>
                </div>
                <p>&nbsp;</p>
</div>

      <?php
include "koneksi.php";
$id=$_GET['id'];
$tampil="select * from  produk where id_produk='$id'";
$hasil=mysql_query($tampil);
$r=mysql_fetch_array($hasil);

//while($data=mysql_fetch_array($edit)){
?>
<table border="0">
<tr>
<td rowspan="5"><?php echo "<img border=2 src='../ngadimin/produk/foto/$r[gambar]' border=0 width=200 height=200>"; ?> </td>
<td>&nbsp;</td>
<td><strong><?php echo $r['nama_produk']; ?></strong></td>
<td>
</td>
</tr> 
<tr>
<td></td>
<td>tersedia : <?php echo $r['deskripsi']; ?></td>
<td>&nbsp;</td>
</tr> 
<tr>
<td>&nbsp;</td>
<td>harga Rp <?php echo $r['harga']; ?>,00</td>
<td>&nbsp;</td>
</tr> 
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr> 
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr> 
  </table>
<p>&nbsp;</p>



  <form method="POST" action="simpanjual.php">
<table border="0" align="center">
  <tr>
    <td colspan="3" align="center"><h2>Form Inputan</h2></td>
  </tr>
  <tr>
    <td>Nama barang</td>
    <td>:</td>
    <td><input name="nama_barang" disabled="disabled" type="text" id="nama_barang" value="<?php echo $r['nama_produk']; ?>" /></td>
  </tr>
  <tr>
    <td>Harga Satuan</td>
    <td>:</td>
    <td><input name="harga_satuan" disabled="disabled" type="text" id="harga_satuan" onFocus="mulaiHitung()" onBlur="berhentiHitung()" value="<?php echo $r['harga']; ?>" /></td>
  </tr>
  <tr>
    <td>Jumlah Beli</td>
    <td>:</td>
    <td><input type="text" name="jumlah_beli" id="jumlah_beli" onFocus="mulaiHitung()" onBlur="berhentiHitung()" /></td>
  </tr>
  <tr>
    <td>Total Bayar</td>
    <td>:</td>
    <td><input type="text" name="total_bayar" id="total_bayar" /></td>
  </tr>
  <tr>
    <td>Diskon</td>
    <td>:</td>
    <td><input type="text" name="diskon" id="diskon" /></td>
  </tr>
  <tr>
    <td>Total Setelah Diskon</td>
    <td>:</td>
    <td><input type="text" name="setelah_diskon" id="setelah_diskon" /></td>
  </tr>
  <tr>
    <td>Bayar</td>
    <td>:</td>
    <td><input type="text" name="bayar" id="bayar" onFocus="mulaiHitung()" onBlur="berhentiHitung()"/></td>
  </tr>
  <tr>
    <td>Kembalian</td>
    <td>:</td>
    <td><input type="text" name="kembalian" id="kembalian" /></td>
  </tr>
  <script type="text/javascript">
                                                function mulaiHitung(){
                                                                Interval = setInterval("hitung()",1);
                                                }
                                                function hitung(){
                                                                harga_satuan    = parseInt(document.getElementById("harga_satuan").value);
                                                                jumlah_beli                       = parseInt(document.getElementById("jumlah_beli").value);
                                                                total_bayar        = harga_satuan * jumlah_beli;
                                                                document.getElementById("total_bayar").value = total_bayar;

                                                                diskon = "";
                                                                persen = "";
                                                                if (total_bayar <= 100000) {
                                                                                diskon = (0/100)*total_bayar;
                                                                                persen = "0%";
                                                                }
                                                                else if (total_bayar > 100000 && total_bayar <= 200000) {
                                                                                diskon = (5/100)*total_bayar;
                                                                                persen = "5%";
                                                                }
                                                                else if (total_bayar > 200000 && total_bayar <= 300000) {
                                                                                diskon = (10/100)*total_bayar;
                                                                                persen = "10%";
                                                                }
                                                                else if (total_bayar > 300000) {
                                                                                diskon = (15/100)*total_bayar;
                                                                                persen = "15%";
                                                                }
                                                                document.getElementById("diskon").value = persen +"--> "+diskon;
                                                                setelah_diskon = total_bayar - diskon;
                                                                document.getElementById("setelah_diskon").value = setelah_diskon;
                                                                bayar                                     = parseInt(document.getElementById("bayar").value);
                                                                kembalian                           = bayar - setelah_diskon;
                                                                document.getElementById("kembalian").value = kembalian;
                                                }
                                                function berhentiHitung(){
                                                                clearInterval(Interval);
                                                }
                                </script>
  <tr>
    <td></td>
    <td></td>
    <td><input type="submit" value="Simpan" />
      <input type="reset" value="Reset" /></td>
  </tr>
  <tr>
    <td></td>
    <td></td>
    <td><a href="laporan_penjualan.php">Laporan</a></td>
  </tr>
</table>
</form>
<p>&nbsp;</p><br>
  <br>
</p>

<p>untuk berbelanja di toko kami sangat mudah. anda hanya melihat barang yang tersedia pada tampilan produk. setelah itu anda hubungi kami di no <span class="style5"><strong>085789624133</strong></span> atau pin bb <span class="style5 style10">29b46fd2</span>. transaksi bisa dilakukan melalui bank <span class="style7">BNI </span>dan <span class="style7">Mandiri</span>. untuk ongkos kirim kami menyesuaikan agen pengiriman paket barang. biasanya kami menggunakan <span class="style7">tiki</span> atau <span class="style7">JNE</span>. anda bisa memilih sesuai dengan keinginan anda. bila anda ingin membeli dalam jumlah banyak/grosir, maka harga bisa sedikit miring. terima kasih telah mengunjungi situs kami. selamat berbelanja. <span class="style8"><strong>.::'kepuasan customer adalah kebanggaan buat kami'::..</strong></span></p>
</div>
<p class="style9">PARTNER KAMI </p>
<table width="875" border="0" align="center">
  <tr>
    <td align="center"><img src="images/cek-kiriman-paket-barang-TIKI.jpg" width="150" height="100" /><img src="images/TIKI-JNE.gif" width="150" height="100" /><img src="images/bank-mandiri-logo11.jpg" width="150" height="100" /><img src="images/248_logo.jpg" width="200" height="100" /></td>
  </tr>
</table>
<p>&nbsp;</p>
<div id="copyright" class="container">
              </DIV>
</body>
</html>

6. laporan_penjualan
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
 <link rel="stylesheet" href="style.css">


 <script type="text/javascript" src="jquery.js"></script>

<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900" rel="stylesheet" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />

<!--[if IE 6]><link href="default_ie6.css" rel="stylesheet" type="text/css" /><![endif]-->

<style type="text/css">
.kotak {
height:250px;
width : 180px;
padding:10px;
background-color:#ffffff;
width:250px;
margin-top:10px; }

.sub-barang{
text-align:center;
padding:5px;
width:210px;
float:left;
border:1px dashed #333333;
                -moz-border-radius:4px;
                -khtml-border-radius: 4px;
                -webkit-border-radius: 4px;
                margin:5px 5px 10px 5px;
}
.jdl-brg{
font-size:14px;
height:200px;
margin-bottom:70px;
font-family:"Comic Sans MS";
}

</style>

<style type="text/css">
img {
padding:5px;
background-color:000066;
border-radius:20px;
}
</style>

<style type="text/css">
<!--
.style9 {                color: #FF0000;
                font-size: 18pt;
}
.style10 {
                color: #8dc63f;
                font-weight: bold;
}
body,td,th {
                font-family: "Source Sans Pro", sans-serif;
}
a:link {
                color: #FFFFFF;
}
a:hover {
                color: #0099FF;
}
-->
</style>
</head>
</head>
<body>
<div id="header" class="container">
  <div id="logo">
    <h1><a href="#">HFShop</a></h1>
  </div>
  <div id="menu">
                                <ul>
                                                <li class="active"><a href="index.php" accesskey="1" title=""><span class="glyphicon glyphicon-home"></span> Home</a></li>
                                                <li><a href="aboutus.php" accesskey="3" title=""><span class="glyphicon glyphicon-user"></span> Tentang</li>
                                                <li><a href="carabelanja.php" accesskey="4" title=""><span class="glyphicon glyphicon-shopping-cart"></span> &nbsp;cara belanja</a></li>
                                                <li><a href="contactus.php" accesskey="5" title=""><span class="glyphicon glyphicon-earphone"></span> &nbsp;Kontak</a></li>
                                </ul>
  </div>
                <p>&nbsp;</p>
</div><form>
  <table width="961" align="center">
                                <tr>
                                                <td colspan="12" align="center"><h2><span class="glyphicon glyphicon-object-align-bottom"></span>           Laporan Penjualan</h2>
                                    <p>&nbsp;</p>
                                    <p>&nbsp;</p></td>
                                </tr>
                                <tr>
                                                <td width="30">No</td>
                                                <td width="117">Jumlah</td>
                                                <td width="119">Total</td>
                                                <td width="97">Diskon</td>
                                                <td width="159">Total Setelah Diskon</td>
                                                <td width="96">Bayar</td>
                                                <td width="162">Kembalian</td>
                                                <td width="145" colspan="2" align="center">Aksi</td>
                                </tr>
                                <?php
                                                include "koneksi.php";
                                                $sql = mysql_query("select * from tabel_penjualan order by no asc") or die("Menampilkan data GAGAL");
                                                while ($data = mysql_fetch_array($sql)) {
                                                                $no                                        = $data['no'];
                                                                $nama_barang = $data['nama_barang'];
                                                                $harga_satuan  = $data['harga_satuan'];
                                                                $jumlah_beli     = $data['jumlah_beli'];
                                                                $total_harga      = $data['total_harga'];
                                                                $diskon                                = $data['diskon'];
                                                                $setelah_diskon = $data['setelah_diskon'];
                                                                $bayar                                  = $data['bayar'];
                                                                $kembalian                        = $data['kembalian'];  ?>
                                <tr>
                               
                                                <td><?php echo $no;?></td>
                                                <td><?php echo $jumlah_beli;?></td>
                                                <td><?php echo $total_harga;?></td>
                                                <td><?php echo $diskon;?></td>
                                                <td><?php echo $setelah_diskon;?></td>
                                                <td><?php echo $bayar;?></td>
                                                <td><?php echo $kembalian;?></td>
                                                <td><a href="form_update.php?no=<?php echo $no;?>"             button type="button" class="btn btn-primary">Update</a>
            <a href="hapus_laporan.php?n_no=<?php echo $no;?>" button type="button" class="btn btn-warning">Hapus</a>
            </td>
                                </tr>
                                <?php } ?>
                                <tr>
                                 <center></center>
                                </tr>
  </table>
 <p> <center><a href="index.php" ><span class="glyphicon glyphicon-shopping-cart"></span>Beli Lagi</a></center>
</form>
<p class="style9">PARTNER KAMI </p>
<table width="875" border="0" align="center">
  <tr>
    <td align="center"><img src="images/cek-kiriman-paket-barang-TIKI.jpg" width="150" height="100" /><img src="images/TIKI-JNE.gif" width="150" height="100" /><img src="images/bank-mandiri-logo11.jpg" width="150" height="100" /><img src="images/248_logo.jpg" width="200" height="100" /></td>
  </tr>
</table>
<p>&nbsp;</p>
<div id="copyright" class="container">
                <p>Copyright (c) 2017<a href="index.php" rel="nofollow">HFShop</a>.</p>
</div>
</body>
</html>


7. form_update.php
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
 <link rel="stylesheet" href="style.css">


 <script type="text/javascript" src="jquery.js"></script>

<?php
                include "koneksi.php";
                $no = $_GET['no'];
                $sql = mysql_query("select * from tabel_penjualan where no='$no'");
                while ($data = mysql_fetch_array($sql)) {
                                $no                                        = $data['no'];
                                $nama_barang = $data['nama_barang'];
                                $jenis_barang   = $data['jenis_barang'];
                                $harga_satuan  = $data['harga_satuan'];
                                $jumlah_beli     = $data['jumlah_beli'];
                                $total_harga      = $data['total_harga'];
                                $diskon                                = $data['diskon'];
                                $setelah_diskon = $data['setelah_diskon'];
                                $bayar                                  = $data['bayar'];
                                $kembalian                        = $data['kembalian'];
                }
?>
<form method="POST" action="update_penjualan.php ?no=<?php echo $no;?>">
                <table border="0" align="center">
                                <tr>
                                  <td colspan="3" align="center" style=font-color"#093"><h2><font color="#009933">Form Update</h2></td>
                                </tr>
                                <tr>
                                                <td>Nama barang</td>
                                                <td>:</td>
                                                <td><input type="text" name="nama_barang" id="nama_barang" value="<?php echo $nama_barang; ?>" /></td>
                                </tr>
                                <tr>
                                                <td>Jenis Barang</td>
                                                <td>:</td>
                                                <td><input type="text" name="jenis_barang" id="jenis_barang" value="<?php echo $jenis_barang;?>"/></td>
                                </tr>
                                <tr>
                                                <td>Harga Satuan</td>
                                                <td>:</td>
                                                <td><input type="text" name="harga_satuan" id="harga_satuan" value="<?php echo $harga_satuan;?>" onfocus="mulaiHitung()" onblur="berhentiHitung()" /></td>
                                </tr>
                                <tr>
                                                <td>Jumlah Beli</td>
                                                <td>:</td>
                                                <td><input type="text" name="jumlah_beli" id="jumlah_beli" value="<?php echo $jumlah_beli;?>" onfocus="mulaiHitung()" onblur="berhentiHitung()" /></td>
                                </tr>
                                <tr>
                                                <td>Total Bayar</td>
                                                <td>:</td>
                                                <td><input type="text" name="total_bayar" id="total_bayar" value="<?php echo $total_harga;?>"/></td>
                                </tr>
                                <tr>
                                                <td>Diskon</td>
                                                <td>:</td>
                                                <td><input type="text" name="diskon" id="diskon" value="<?php echo $diskon;?>"/></td>
                                </tr>
                                <tr>
                                                <td>Total Setelah Diskon</td>
                                                <td>:</td>
                                                <td><input type="text" name="setelah_diskon" id="setelah_diskon" value="<?php echo $setelah_diskon;?>"/></td>
                                </tr>
                                <tr>
                                                <td>Bayar</td>
                                                <td>:</td>
                                                <td><input type="text" name="bayar" id="bayar" value="<?php echo $bayar;?>" onfocus="mulaiHitung()" onblur="berhentiHitung()"/></td>
                                </tr>
                                <tr>
                                                <td>Kembalian</td>
                                                <td>:</td>
                                                <td><input type="text" name="kembalian" id="kembalian" value="<?php echo $kembalian;?>"/></td>
                                </tr>
                                <script type="text/javascript">
                                                function mulaiHitung(){
                                                                Interval = setInterval("hitung()",1);
                                                }
                                                function hitung(){
                                                                harga_satuan    = parseInt(document.getElementById("harga_satuan").value);
                                                                jumlah_beli                       = parseInt(document.getElementById("jumlah_beli").value);
                                                                total_bayar        = harga_satuan * jumlah_beli;
                                                                document.getElementById("total_bayar").value = total_bayar;

                                                                diskon = "";
                                                                persen = "";
                                                                if (total_bayar <= 100000) {
                                                                                diskon = (0/100)*total_bayar;
                                                                                persen = "0%";
                                                                }
                                                                else if (total_bayar > 100000 && total_bayar <= 200000) {
                                                                                diskon = (10/100)*total_bayar;
                                                                                persen = "10%";
                                                                }
                                                                else if (total_bayar > 200000 && total_bayar <= 300000) {
                                                                                diskon = (20/100)*total_bayar;
                                                                                persen = "20%";
                                                                }
                                                                else if (total_bayar > 300000) {
                                                                                diskon = (30/100)*total_bayar;
                                                                                persen = "30%";
                                                                }
                                                                document.getElementById("diskon").value = persen +"--> "+diskon;
                                                                setelah_diskon = total_bayar - diskon;
                                                                document.getElementById("setelah_diskon").value = setelah_diskon;
                                                                bayar                                     = parseInt(document.getElementById("bayar").value);
                                                                kembalian                           = bayar - setelah_diskon;
                                                                document.getElementById("kembalian").value = kembalian;
                                                }
                                                function berhentiHitung(){
                                                                clearInterval(Interval);
                                                }
                                </script>
                                <tr>
                                                <td></td>
                                                <td></td>
                                                <td><input type="submit" value="Update" button type="button" class="btn btn-primary" /><input type="reset" value="Reset" button type="button" class="btn btn-danger" /></td>
                                </tr>
                                <tr>
                                                <td></td>
                                                <td></td>
                                                <td><a href="laporan_penjualan.php" ><span class="glyphicon glyphicon-shopping-cart"></span>Laporan Pembelian</a></td>
                                </tr>
                </table>
</form>


8. simpanjual.php
<?php
                $nama_barang  = $_POST['nama_barang'];
                $harga_satuan  = $_POST['harga_satuan'];
                $jumlah_beli     = $_POST['jumlah_beli'];
                $total_bayar      = $_POST['total_bayar'];
                $diskon                                = substr($_POST['diskon'], 6);
                $setelah_diskon              = $_POST['setelah_diskon'];
                $bayar                                  = $_POST['bayar'];
                $kembalian                        = $_POST['kembalian'];
                $no                                                        = "";

                include "koneksi.php";
                $sql = mysql_query("insert into tabel_penjualan values (
                                '$no',
                                '$nama_barang',
                                '$harga_satuan',
                                '$jumlah_beli',
                                '$total_bayar',
                                '$diskon',
                                '$setelah_diskon',
                                '$bayar',
                                '$kembalian'
                                )") or die("Menyimpan data GAGAL <meta http-equiv=refresh content=3;url=index.php>");
                echo "Menyimpan data BERHASIL <meta http-equiv=refresh content=3;url=laporan_penjualan.php>";
?>




9. hapus_laporan.php
<?php
                include "koneksi.php";
                $no = $_GET['n_no'];
                $query = mysql_query("delete from tabel_penjualan where no = '$no'") or die ("Menghapus data GAGAL <meta http-equiv=refresh content=3;url=laporan_penjualan.php>");
                echo "Menghapus data BERHASIL <meta http-equiv=refresh content=3;url=laporan_penjualan.php>";
?>
10. Koneksi.php
<?php
$servername = "localhost";
$user                     = "root";
$pasword            = "";
$db                                        = "bambukuning1";

$koneksi = mysql_connect ($servername,$user, $pasword)
                                                or die ('gagal terkoneksi'.mysql_error());
                                               
$database = mysql_select_db ($db)
                                                or die ('gagal terhubung ke database'.mysql_error());
?>




 ===========================DATABASE YANG DIGUNAKAN===================













0 Komentar untuk "PENJUALAN ONLINE DENGAN CRUD "

Silakan tinggalkan komentar anda. DILARANG KERAS menyimpan link blog/web pada komentar dengan tujuan backlink, Spam.

 
Copyright © 2014 Tutorial Kampus - All Rights Reserved
Template By. Catatan Info