Anda di halaman 1dari 20

INDEX

<html >
<head>
<meta http-equiv="Content-Type"
content="text/html;
charset=windows-1252" />
<title>DISTRO</title>
<link rel="stylesheet"
type="text/css" href="style.css" />
<!--[if IE 6]>
<link rel="stylesheet"
type="text/css" href="iecss.css" />
<![endif]-->
<script type="text/javascript"
src="js/boxOver.js"></script>
</head>
<body>
<div id="main_container">
<div class="top_bar">
<div class="top_search">
<div class="search_text"><a
href="#">Cari Produk</a></div>
<form
action="?page=cari.php"
method="post" name="daftar"
id="daftar">
<input type="text"
class="search_input" name="search"
/>
<input type="image"
src="images/search.gif"
class="search_bt"/>
</form>
</div>
<div class="languages">
</div>
</div>
<div id="header">
<div class="oferte_content">
<div class="oferta">
<div
class="oferta_content"></div>
</div>
</div> <!-- end of
oferte_content-->
</div>

<div id="main_content">
<div id="menu_tab">
<div
class="left_menu_corner"></div>
<ul class="menu">
<li><a
href="index.php" class="nav1">
Home </a></li>
<li
class="divider"></li>
<li><a
href="?page=produk.php"
class="nav2">Semua
Produk</a></li>
<!--<li
class="divider"></li>
<li><a
href="?page=daftar.php"
class="nav3">Daftar</a></li>-->
<li
class="divider"></li>
<li><a
href="?page=info-beli.php"
class="nav4">Aturan
Belanja</a></li>
<li
class="divider"></li>
<li><a
href="?page=contact.php"
class="nav5">Buku Tamu</a></li>
<li
class="divider"></li>
<li><a
href="?page=tentang_kami.php"
class="nav5">Tentang
Kami</a></li>
<li><a
href="?page=bukti_pengiriman.php"
class="nav6">Bukti
Pengiriman</a></li>
<li
class="divider"></li>
</ul>
<div
class="right_menu_corner"></div>
</div><!-- end of menu tab ->

<div class="left_content">
<!--<div
class="title_box">Kategori</div> ->
<?php
// include"config.php";
//
$sql = "SELECT * FROM
kategori order by id_kategori asc";
//
$hasil = mysql_query($sql,
$id_mysql);
//
$jumlah = 0;
//
while($baris =
mysql_fetch_array($hasil)) {
//
echo "<ul
class='left_menu'>
//
<li class='odd'><a
href='?page=kategori_det.php&amp;
id=",$baris['id_kategori'],"'>",$baris[
'nama_kategori'],"</li></ul> </a>";
//
}
//
mysql_close($id_mysql);
?>
<div class="title_box">Produk
Spesial</div>
<div class="border_box">
<?php
include"config.php";
$sql = "SELECT * FROM
tbl_barang WHERE ket='Spesial'
order by tgl_masuk DESC";
$hasil = mysql_query($sql,
$id_mysql);
$jumlah = 0;
$baris =
mysql_fetch_array($hasil);
echo "<div
class='product_title'><a
href='?page=produk_detail.php&am
p;id=",$baris['id'],"'>",$baris['nm_br
g'],"</a></div>";
echo "<div
class='product_img'><a
href='?page=produk_detail.php&am
p;id=",$baris['id'],"'>
<img
src='upload/$baris[gambar]' alt=''

width='150' height='150' title=''


border='0' /></a></div>";
echo "<div
class='prod_price'><span
class='price'>Rp. ",$baris['harga'],",</span></div>";
include"config.php";
mysql_close($id_mysql);
?>
</div>
<div
class="title_box">Login</div>
<div class="border_box">
<?php
if ($_SESSION['username'] =="")
{
?>
<form
action="login.php?page=index"
method="post">
<table border="0" height="115"
align="center">
<tr>
<td height="35">
<input
type="text" name="username"
class="newsletter_input"
value="username anda"/>
</td>
</tr>
<tr>
<td height="35">
<input
type="password" name="pass"
class="newsletter_input"
value="password anda"/>
</td>
</tr>
<tr>
<td align=left>Silahkan
Klik <a
href=?page=daftar.php>Daftar</a>
untuk registrasi</td>
</tr>
<tr>
<td height="37">

<input type="submit"
value="masuk"/><input type="reset"
value="batal" />
</td>
</tr>
</table>
</form>
<?php
}
else
{
?>
<table border="0"
height="82" align="center">
<tr>
<td height="78"
align="center">
<?php
echo
"<center>User : ".$username, ", <a
href=logout.php?maukeluar=iya>Kel
uar</a></center>";
?>
</td>
</tr>
</table>
<?php
}
?>
</div>
<div
class="title_box">Merk</div>
<?php
include"config.php";
$sql = "SELECT
id_merk,nama_merk FROM merk
order by id_merk ASC";
$hasil = mysql_query($sql,
$id_mysql);
$jumlah = 0;
while($baris =
mysql_fetch_array($hasil)) {
echo "<ul
class='left_menu'>
<li class='odd'><a
href='?page=merk_detail.php&amp;i

d_merk=",$baris['id_merk'],"&amp;n
ama_merk=",$baris['nama_merk'],"'>
",$baris['nama_merk'],"</li></ul>
</a>";
}
mysql_close($id_mysql);
?>
<div class="banner_adds"></div>
</div><!-- end of left content -->
<div class="center_content">
<?
$page = $_GET['page'];
$page =
str_replace(".php","",$page);
//menghilangkan ekstensi .html
$file ="$page.php";
if (!file_exists($file)) {
include ("main.php");
} else if ($page=="" ||
$page=="index"){
include ("index.php"); //memanggil
file yang di-include
} else { // jika file tidak ada
include ("$page.php");
}
?>
</div>
<div class="right_content">
<div class="shopping_cart">
<div
class="cart_title"><?php echo "<a
href='?page=keranjang_belanja.php'
>Keranjang Belanja</a>";?></div>
<div class="cart_details">
<?php
include
"config.php";
$berat=0;
$harga=0;
$jumlah=0;
$total=0;
$statement =
"SELECT * from tbl_keranjang
where username='$username' and
status='' ";

$result =
mysql_query($statement,
$id_mysql);
while($row =
mysql_fetch_array($result))
{
$berat=$berat+$row['berat'];
$total=$total+($row['qty']*$r
ow['harga']);
$jumlah++;
}
echo
"<b><span class='price'><a
href='?page=keranjang_belanja.php'
>",$jumlah,"</a></span></b> item
<br />
<span
class='border_cart'></span>";
echo "Total: <span
class='price'>Rp. ",$total,"-</span>";
?>
</div>
<div class="cart_icon"><a
href="?page=checkout.php"
title="header=[Checkout]
body=[&nbsp;] fade=[on]"><img
src="images/shoppingcart.png"
alt="" title="" width="48"
height="48" border="0"
/></a></div>
</div>
<div class="title_box">Produk
Terbaru</div>
<div class="border_box">
<?php
include"config.php";
$sql = "SELECT * FROM
tbl_barang WHERE ket='Biasa'
ORDER BY tgl_masuk desc";
$hasil = mysql_query($sql,
$id_mysql);
$jumlah = 0;
$baris =
mysql_fetch_array($hasil);
echo "<div
class='product_title'><a

href='?page=produk_detail.php&am
p;id=",$baris['id'],"'>",$baris['nm_br
g'],"</a></div>";
echo "<div
class='product_img'><a
href='?page=produk_detail.php&am
p;id=",$baris['id'],"'><img
src='upload/$baris[gambar]'
width='150' height='150' alt='' title=''
border='0' /></a></div>";
echo "<div
class='prod_price'><span
class='price'>Rp. ",$baris['harga'],",</span></div>";
include"config.php";
mysql_close($id_mysql);
?>
</div>
<div
class="title_box">Kategori</div>
<?php
include"config.php";
$sql = "SELECT
id_kategori,nama_kategori FROM
kategori order by id_kategori asc";
$hasil = mysql_query($sql,
$id_mysql);
$jumlah = 0;
while($baris =
mysql_fetch_array($hasil)) {
echo "<ul
class='left_menu'>
<li class='odd'><a
href='?page=kategori_detail.php&am
p;id_kategori=",$baris['id_kategori'],
"&amp;nama_kategori=",$baris['nam
a_kategori'],"'>",$baris['nama_kateg
ori'],"</li></ul> </a>";
}
mysql_close($id_mysql);
?>
<div class="title_box">Rekening
Bank</div>
BCA # 4900-028-917<br />
<img
src="images/icon_bca.gif"> <br />
BNI # 013-181-598-1<br />

<img src="images/icon_bnib.gif"><br />


Bank Mandiri # 119-000-428736-1 <br />
<img src="images/icon_mandirib.gif">
<div class="banner_adds"></div>
</div><!-- end of right content -->
<div class="footer">
<div class="left_footer"></div>
<div class="center_footer">
<p>All Rights Reserved
2014</p>
<p>Created By Ibnul
Qoyyum<br />
</p>
<div
class="right_footer"></div>
</div>
</div>
</body>
</html>

LOGIN
<?php
session_start();
include "config.php" ;
$page=$_GET['page'];
$username =
$_POST['username'];
$password = $_POST['pass'];
$passwordhash =
md5($password); // mengenkripsikannya
untuk dicocokan dengan database
$sql = mysql_query("SELECT *
FROM member WHERE
username='$username' &&
sesi='$passwordhash'");
$sql2 = "SELECT * FROM
member WHERE
username='$username' &&
sesi='$passwordhash'";
$hasil = mysql_query($sql2,
$id_mysql);
$baris =
mysql_fetch_array($hasil);
$num = mysql_num_rows($sql);
if($num==1) {

// login benar //
if
($baris['level']=="admin")
{
$_SESSION['username'] = "";
$_SESSION['password'] = "";
$_SESSION['level'] = "";
header("location: index.php");
}
else
{
$_SESSION['username'] =
$username;
$_SESSION['password'] =
$password;
$_SESSION['level'] =
$baris['level'];
header("location: index.php");
}
}
else
{
// jika login salah //
$_SESSION['username'] = "";
$_SESSION['password'] = "";
$_SESSION['level'] = "";
header("location: index.php");
}
?>

PRODUK
<div
class="center_title_bar_2">Daftar
Produk :: </div>
<table >
<tr bgcolor="#847676">
<td>
<form method="POST"
action="?page=produk.php">
<select name = "cari">
<option value="">--Pilih Kategori-</option>
<?php
include"include/config.php";
$s = "SELECT
id_kategori,nama_kategori FROM
kategori order by id_kategori DESC";
$q = mysql_query($s);
while($d = mysql_fetch_assoc($q))

{
echo "<option
value='$d[id_kategori]'>$d[nama_kateg
ori]</option>";
}
?>
</select>
<input type="submit" value="Filter">
</form>
</td>
</tr>
</table>
<?php
$cari=$_POST['cari'];
$perhalaman = 10; //
tentukan jumlah data perhalaman
$halaman = isset($_GET["hal"])
? $_GET["hal"] : "0";
// jika ada parameter halaman,
ambil. jika tidak, isikan kosong
$awal = $halaman *
$perhalaman;// hitung posisi awal data
(offset)
if(!isset($page))
{

INNER JOIN merk


ON (merk.id_merk =
tbl_barang.id_merk)
WHERE
`tbl_barang`.`id_kategori` like
'%$cari%'
limit
$awal, $perhalaman";
$query_jumlah = "select
count(*) from tbl_barang";
}
else
{
$sql = "SELECT
tbl_barang.*,
kategori.id_kategori,
kategori.nama_kategori,
merk.id_merk,
merk.nama_merk
FROM
tbl_barang

$page=0;

INNER JOIN kategori

}
include"include/config.php";

ON (kategori.id_kategori =
tbl_barang.id_kategori )
INNER JOIN merk

if
(isset($_POST['cari']) )

ON (merk.id_merk =
tbl_barang.id_merk)
{

limit
$sql =

"SELECT
tbl_barang.*,
kategori.id_kategori,
kategori.nama_kategori,
merk.id_merk,
merk.nama_merk
FROM
tbl_barang
INNER JOIN kategori
ON (kategori.id_kategori =
tbl_barang.id_kategori )

$awal, $perhalaman";
$query_jumlah = "select
count(*) from tbl_barang";
}
$hasil = mysql_query($sql,
$id_mysql);
$rs_jumlah =
mysql_query($query_jumlah) or
die(mysql_error());
$r =
mysql_fetch_row($rs_jumlah);// ambil
jumlah total data

// hitung total
halaman
$total_halaman = ceil($r[0] /
$perhalaman);
// bentuk halaman, di
sini intinya
$halaman_str = ""; //
kosongkan variabel
// jika berada pada halaman
kedua atau lebih, tampilkan link
[sebelumnya]
if ($halaman > 0)
{
$hal =
$halaman - 1;
$halaman_str .= "<a
href='?page=produk.php&amp;hal=$hal'
title='Halaman sebelumnya'>[Prev]</a>
";
}

href='?page=produk.php&amp;hal=$hal'
title='Halaman berikutnya'>[Next]</a>
";
}
// bentuk format
halaman
$halaman_str =
"<div
id='halaman'>$halaman_str</div>\n";
while($baris =
mysql_fetch_array($hasil))
{

?>
<table border='0' width='600'
align='left'>

// ambil semua nomor halaman


<tr>
for ($i = 0; $i <
$total_halaman; $i++)

<td width='20'
align='right'>
{
<?php
$hal =

$i + 1;
if ($i
== $halaman) // jika halaman aktif,
tidak usah diberi link
$halaman_str .= "$hal ";

echo
"<b>",$jumlah+1,". </b>";
?>
</td>
<td width='70'

else
$halaman_str .= "<a
href='?page=produk.php&amp;hal=$i'
title='Halaman $hal'>$hal</a> ";
}
// jika bukan
berada pada halaman terakhir
if ($halaman <
($total_halaman - 1))
{
$hal = $halaman + 1;
$halaman_str .= "<a

align='center'>
<?php
echo "<a
href='?page=produk_detail.php&amp;id
=",$baris['id'],"'><img
src='upload/$baris[gambar]' width='70'
height='70' alt='' title='' border='0'
/></a>";
?>

</td>

echo " ";

<td align='left'
width='150'>
<?php
echo "<u><b><a
href='?page=produk_detail.php&amp;id
=",$baris['id'],"'>",$baris['nm_brg'],"</a
></u></b><br>";

echo"<a
href='?page=produk_detail.php&amp;id
=",$baris['id'],"'><img
src='images/checked.png'>
Detail</a></div>";

?>

echo "<span
class='blue'>",$baris['nama_merk']," |
",$baris['nama_kategori'],"</span>";

</td>
</tr>
<tr>

echo
"<br><span
class='blue'>",$baris['desk'],"</span>";
?>

<td colspan='5'
align='center'><hr width="85%" /></td>
</tr>
<?php

</td>
$jumlah++;
<td align='left'

<?php

?>

width='100'>

echo "<div
class='prod_price_big'><span
class='price'>Rp.";

</table>
<?php
include"config.php";

echo
"",$baris['harga'],"</span></div>";
?>
</td>
<td width='100'

mysql_close($id_mysql);
echo
"<div
class='center_title_bar'>",$halaman_str,
"</div>";
?>

align='left'>
<?php
echo "<div
class='product_title'><a
href='?page=beli.php&amp;id=",$baris['
id'],"'><img src='images/checked.png'>
Beli</a>";

</div><!-- end of center content -->


</body>
</html>

KERANJANG BELANJA
<?php
session_start();
$username=$_SESSION['username'];

include "config.php";
if (empty($username))
{
include "daftar.php";
}
else
{
?>
<div class="center_content">
<div
class="center_title_bar">Rincian
Belanja Anda</div>
<div class="prod_box_big">
<div
class="top_prod_box_big"></div>
<div
class="center_prod_box_big">
<table border='0' width='600'
align='left'>
<tr>
<td width='100'
align='Left'>Nama Produk</td>

include"config.php";

include "config.php";
$sql =
"SELECT * from tbl_keranjang where
username='$username' and status=''";
$hasil =
mysql_query($sql, $id_mysql);
while($baris =
mysql_fetch_array($hasil))
{
$t=$baris['kd_brg'];
$sqlnya = "SELECT
tbl_barang.*,
kategori.id_kategori,
kategori.nama_kategori,

<td width='40'
align='center'>Hapus</td>
<td width='50'
align='left'>Harga</td>

merk.id_merk,
merk.nama_merk
FROM
tbl_barang
INNER

<td width='50'
align='left'>Size</td>

JOIN kategori

<td width='20'
align='center'>Qty</td>

(kategori.id_kategori =
tbl_barang.id_kategori)

ON

INNER
<td width='20'
align='center'>Berat (Kg)</td>

JOIN merk

<td width='60'
align='left'>Total</td>

ON
(merk.id_merk = tbl_barang.id_merk)
WHERE
kd_brg='$t'";

<td width='70'
align='left'>Update</td>

$hasilnya =
mysql_query($sqlnya, $id_mysql);

</tr>
<?php

$barisnya =
mysql_fetch_array($hasilnya);

echo "<form method='POST'


action='ubah_keranjang.php?no=",$bari
s['no_trans'],"&kd_brg=",$baris['kd_brg'
],"'><tr>";

{
echo "<td
align='center'><input type='text'
name='qty' size='1' value='0' /></td>";

echo "<td align='left'>


}
<u><b><a
href='?page=produk_detail.php&amp;kd
_brg=",$baris['kd_brg'],"'>",$barisnya['n
m_brg'],"</a></u></b><br>
<span
class='blue'>",$barisnya['nama_merk'],"
| ",$barisnya['nama_kategori'],"</span>

else
{
echo "<td
align='center'><input type='text'
name='qty' size='1'
value='",$baris['qty'],"' /></td>";

</td>";
}
echo "<td align='center'><a
href='hapus_keranjang.php?no=",$baris[
'no_trans'],"&kd_brg=",$baris['kd_brg'],
"'&qty=",$_GET['qty'],"><img
src='images/hapus.gif' /></a></td>";
echo "<td
align='left'>Rp. ",$baris['harga'],"</td>";
if
($baris['size_huruf']==""){?>
<td><select
name="size_huruf" id="size_huruf">
<option value="All
Size" />All Size</option>
<option
value="Junior" />Junior</option>
<option
value="Small" />Small</option>
<option
value="Large" />Large</option>
<option
value="Medium" />Medium</option>
<option value="Xtra
Large" />Xtra Large</option>
</select></td>
<?
}else{
echo "<td
align='center'>",$baris['size_huruf'],"
</td>";
}
if ($baris['qty']=="")

echo "<td
align='center'>",$baris['berat'],"</td>";

if ($baris['qty']=="")
{
echo "<td
align='left'>Rp. ",$baris['harga'],"</td>";
}
else
{
echo "<td
align='left'>Rp.
",$baris['qty']*$baris['harga'],"</td>";
}
echo "<td align='left'><input
type='submit' value='Update'
size='40'></a></td>";
echo "</tr></form>";
}

?>
<td width='75'
align='left'><b>Rp. <?php echo
$total;?></b></td>

</table>
</div>
<?php
include

<td width='65' align='left'></td>

"config.php";
$berat=0;
$harga=0;
$total=0;
$statement =
"SELECT * from tbl_keranjang where
username='$username' and status='' ";
$result =
mysql_query($statement, $id_mysql);
while($row =
mysql_fetch_array($result))
{
$kd_brg =
$row['kd_brg'];
$berat=$berat+$row['berat'];
$total=$total+($row['qty']*$row
['harga']);

</tr>
</table>
</div>
<div class="center_title_bar"><a
href='index.php'>Belanja Lagi</a> | <a
href='?page=checkout.php'>Selesai
Belanja</a></div>
</div><!-- end of center content -->
<script type="text/javascript">
function
carimedicalrecord()
{
windowku=window.open("medi
cal_record_data_find.php" , "Cari
Rekam Medis", "height=400,
width=700, scrollbars=yes, location=no,
top=" + (screen.height-300)/2 + ", left="
+ (screen.width-700)/2);

}
?>
<div
class="bottom_prod_box_big"></div>
<table
border='0' width='600' align='left'>
<tr>
<td width='100'
align='Left'><b>Total : </b></td>
<td width='70'
align='center'></td>

windowku.OuterHeight="100";
}
function carikamar()
{
windowku=window.open("room
_data_find.php" , "Cari Kamar",
"height=400, width=700, scrollbars=yes,
location=no, top=" + (screen.height300)/2 + ", left=" + (screen.width700)/2);
windowku.OuterHeight="100";
}

<td width='50' align='left'></td>


var xmlhttp = createRequestObject();
<td width='20'
align='center'></td>
<td width='20'
align='center'><b><?php echo $berat;?>
Kg</b></td>

function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet
Explorer"){

ro = new
ActiveXObject("Microsoft.XMLHTTP"
);
}else{
ro = new XMLHttpRequest();
}
return ro;
}
function dinamis(combobox)
{
var kota = combobox.value;
if (!kota) return;
xmlhttp.open('get',
'get_data_tarif.php?kota='+kota, true);
xmlhttp.onreadystatechange =
function()
{
if ((xmlhttp.readyState == 4) &&
(xmlhttp.status == 200))
{
document.getElementById("tarif_kirim"
).innerHTML = xmlhttp.responseText;
if (!kota) return;
xmlhttp.open('get',
'get_data_total_bayar.php?kota='+kota,
true);
xmlhttp.onreadystatechange =
function()
{
if
((xmlhttp.readyState == 4) &&
(xmlhttp.status == 200))
{
document.getElementById("tota
l_bayar").innerHTML =
xmlhttp.responseText;
}
return false;
}
xmlhttp.send(null);
}
return false;
}
xmlhttp.send(null);
}
</script>

<?php } ?>

BELI
<?php
session_start();
$username=$_SESSION['username'];
if (empty($username))
{
include "daftar.php";
}
else
{
?>
<div
class="center_title_bar">Keranjang
Belanja</div>
<div class="prod_box_big">
<div
class="top_prod_box_big"></div>
<div
class="center_prod_box_big">
<?php
include ("config.php");
$sql = "SELECT * from tbl_barang
where id='$_GET[id]'";
$hasil = mysql_query($sql,
$id_mysql);
$baris = mysql_fetch_array($hasil);
$harga=$baris['harga'];
$berat=$baris['berat'];
$kd_brg=$baris['kd_brg'];
if ($baris['stok']=='0')
{
echo "<center>Stok
Kosong<br><a
href='index.php'>Kembali</a></center>
";
}
else
{
$perintah="SELECT
kd_brg from tbl_keranjang where
kd_brg='$kd_brg' and status='' and
username='$username'";
$result=mysql_query($perintah,
$id_mysql);

$row=mysql_fetch_array($resul

<script language="JavaScript">

t);
echo $row['harga'];
if ($row==TRUE)
{
?>
<script
language="JavaScript">
document.location='index.php'

document.location='index.php?p
age=keranjang_belanja.php'
</script>
<?php
}
$perintah =
"SELECT * from tbl_barang where
kd_brg='$kd_brg'";

</script>
<?php

$result=mysql_query($perintah,
$id_mysql);

}
else
{

$row=mysql_fetch_array($result);
$stok=$row['stok'];

include("config.php");
$bl=date("m");
$th=date("Y");
$tgl=date("d");
$tg=sprintf("%02d%02d%02d",
$th,$bl,$tgl);
$query=
"INSERT INTO tbl_keranjang
VALUES
('','$username','','$kd_brg','$harga',
'0','$berat','','','$bl','','','$tg','')";
mysql_query($query,
$id_mysql);
if
(mysql_affected_rows() >0)
{
?>
<script language="JavaScript">
document.location='index.php?p
age=keranjang_belanja.php'
</script>
<?php
}
else
{
?>

if ($stok < 1)
{
echo
"<center>Stok Tidak Cukup<br><a
href='keranjang_belanja.php'>Kembali<
/a></center>";
}
//
else
//
{
//
$updatestok=$stok-1;
//
$squery="UPDATE tbl_barang
SET stok='$updatestok' WHERE
kd_brg='$kd_brg'";
//
mysql_query($squery,
$id_mysql);
//
//
$query="UPDATE
tbl_keranjang SET qty='$qty' WHERE
no_trans='$no_trans'";
//
mysql_query($query,
$id_mysql);
//
}
}
}
?>

</div>
</div>
<?php } ?>

ADMIN HOME
<html
xmlns="http://www.w3.org/1999/xhtml"
>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=windows1252" />
<title>Distro</title>
<link rel="stylesheet" type="text/css"
href="style.css" />
<!--[if IE 6]>
<link rel="stylesheet" type="text/css"
href="iecss.css" />
<![endif]-->
<script type="text/javascript"
src="js/boxOver.js"></script>
<script type="text/javascript"
src="js/jquery-1.8.2.js"></script>
<script type="text/javascript"
src="js/jquery-ui.js"></script>
<script src="js/jquery-1.4.js"
type="text/javascript"></script>
<script src="js/hoverIntent.js"
type="text/javascript"></script>
<style type="text/css">
<!-#main_content .center_content_data
.prod_box_big_data .details table
.addtocart td {
font-family: Verdana, Geneva,
sans-serif;
}
-->
</style>
</head>
<body>
<div id="main_container">
<div class="top_bar">

</div>
<div id="header">
<!--<div id="logo">
<a href="index.html"><img
src="../images/header_bg.jpg" alt=""
title="" border="0" width="237"
height="140" /></a>
</div>
-->
<div class="oferte_content">
<div class="oferta">
<div
class="oferta_content"></div>
</div>
</div> <!-- end of oferte_content->
</div>
<div id="main_content">
<div id="menu_tab">
<div
class="left_menu_corner"></div>
<ul class="menu">
<li><a
href="home.php?page=data.php"
class="nav2">Data Barang</a></li>
<li class="divider"></li>
<li><a
href="home.php?page=tarif.php"
class="nav2">Data Tarif
Kirim</a></li>
<li class="divider"></li>
<li><a
href="home.php?page=supplier.php"
class="nav2">Data Supplier</a></li>
<li class="divider"></li>
<li><a
href="home.php?page=data_gudang.php
" class="nav1">Inventory / Data
Gudang</a></li>
<li class="divider"></li>

<div class="languages">
</div>

<li><a
href="home.php?page=laporan.php"
class="nav6">Laporan</a></li>

<li class="divider"></li>
</ul>
<div
class="right_menu_corner"></div>
</div><!-- end of menu tab -->
<div class="left_content">
<ul class="left_menu">
<li class="odd"></li>
<li class="even"></li>
<li class="odd"></li>
<li class="even"></li>
</ul>
<div class="title_box">Login</div>
<div
class="border_box">
<table border="0"
height="82" align="center">
<tr>
<td height="78" align="center">
<?php
echo
"<center>User : ".$user, ", <a
href=logout.php?maukeluar=iya>Keluar
</a></center>";
?>
</td>
</tr>
</table>
</div>
<div
class="title_box2"></div>
<div class="banner_adds"></div>
</div><!-- end of left content -->
<!-- end of main content -->
<?
$page = $_GET['page'];
$page = str_replace(".php","",$page);
//menghilangkan ekstensi .html
$file ="$page.php";
if (!file_exists($file)) {
include ("main.php");
} else if ($page=="" || $page=="home"){
include ("home.php"); //memanggil file
yang di-include
} else { // jika file tidak ada
include ("$page.php");
}
?>
<div class="footer">

<div class="left_footer"></div>
<div class="center_footer">
<p>All Rights Reserved 2014</p>
<p>Created By Ibnul Qoyyum
</p>
</div>
<div class="right_footer"></div>
</div>
</body>
</html>

DATA BARANG
<div class="center_content_data">
<div
class="center_title_bar_data">Data
Barang</div>
<div
class="prod_box_big_data">
<p>
<table border="0" width="700">
<form
action="home.php?page=data.php"
method="post">
<tr>
<td width="157" align="left">
Merek :
<select name="merek">
<option value="">-Pilih Merek</option>
<?PHP
$s ='SELECT * FROM merk ';
$q = mysql_query($s);
while ($d =
mysql_fetch_assoc($q)){
echo '<option
value='.$d['id_merk'].'>'.$d['nama_merk'
].'</option>';
}
?>
</select>
</td>
<td width="193" align="left">
Kategori :
<select name="kategori">

<option value="">-Pilih
Kategori-</option>
<?PHP
$s ='SELECT * FROM
kategori ';
$q = mysql_query($s);
while ($d =
mysql_fetch_assoc($q)){
echo '<option
value='.$d['id_kategori'].'>'.$d['nama_ka
tegori'].'</option>';
}
?>
</select>
</td>
<td width="110"
align="left"><input type="submit"
value="Filter"><input type="reset"
value="Batal" /></td>
<td width="122" align="left"><a
href="home.php?page=data_add.php"
class="left_menu">Tambah
Data</a></td>
</tr>
</form>
</table>
</p>
<div align="center"
class="details">
<font size="-4">
<table width="743"
border="0" cellpadding="1"
cellspacing="1">
<tr bgcolor="#FEEBC5"
class="addtocart">
<td width="22"><div
align="center"
class="contact">No.</div></td>
<td width="65"><p
align="center">Kode</p>
<p
align="center">Barang</p></td>
<td width="101"><p
align="center">Nama </p>
<p
align="center">Barang</p></td>
<td width="75"><div
align="center">Kategori</div></td>

<td width="46"><div
align="center">Merek</div></td>
<td width="49"><div
align="center">Harga</div></td>
<td width="42"><div
align="center">Jml Display</div></td>
<td width="108"><p
align="center">Tgl </p>
<p
align="center">Display</p></td>
<td colspan="3"
width="71"><div
align="center">Aksi</div></td>
</tr>
<p>
<?php
include("../config.php");
$cari=$_POST["cari"];
$cat=$_POST["kategori"];
$merk=$_POST["merek"];
$perhalaman
=10; // tentukan jumlah data
perhalaman
$halaman =
isset($_GET["hal"]) ? $_GET["hal"] :
"0";
// jika ada
parameter halaman, ambil. jika tidak,
isikan kosong
$awal =
$halaman * $perhalaman;// hitung posisi
awal data (offset)
if(!isset($page))
{
$page=0;
}
include"../config.php";
if
(!empty($cari))
{
include"../config.php";

$sql =
"SELECT

}elseif
(!empty($cat) )

*
FROM
tbl_barang
WHERE
kd_brg like
'%$cari%' or nm_brg like '%$cari%' or
id_kategori like '%$cari%' or id_merk
like '%$cari%' or harga like '%$cari%'
or desk like '%$cari%' or stok like
'%$cari%' or tgl_masuk like '%$cari%'
limit $awal,
$perhalaman";
$query_jumlah = "select
count(*) from tbl_barang";
}
elseif
(!empty($cat) OR (!empty($merk)))
{
include"../config.php";
$sql =

{
include"../config.php";
$sql =
"SELECT
tbl_barang.*,
kategori.id_kategori,
kategori.nama_kategori,
merk.id_merk,
merk.nama_merk
FROM tbl_barang
INNER JOIN
kategori
ON
(kategori.id_kategori =
tbl_barang.id_kategori)
INNER JOIN merk
ON
(merk.id_merk = tbl_barang.id_merk)
WHERE

"SELECT
tbl_barang.*,
kategori.id_kategori,
kategori.nama_kategori,
merk.id_merk,
merk.nama_merk
FROM tbl_barang
INNER JOIN
kategori
ON
(kategori.id_kategori =
tbl_barang.id_kategori)
INNER JOIN merk
ON
(merk.id_merk = tbl_barang.id_merk)
WHERE
tbl_barang.id_kategori like '%$cat%'
and tbl_barang.id_merk like
'%$merk%'ORDER BY kd_brg DESC
limit $awal, $perhalaman";
$query_jumlah = "select
count(*) from tbl_barang";

tbl_baarang.id_kategori like '%$cat%'


ORDER BY kd_brg DESC limit $awal,
$perhalaman";
$query_jumlah = "select
count(*) from tbl_barang";
}elseif
(!empty($merk) )
{
include"../config.php";
$sql =
"SELECT
tbl_barang.*,
kategori.id_kategori,
kategori.nama_kategori,
merk.id_merk,
merk.nama_merk
FROM tbl_barang
INNER JOIN
kategori
ON
(kategori.id_kategori =
tbl_barang.id_kategori)

INNER JOIN merk


ON
(merk.id_merk = tbl_barang.id_merk)
WHERE
tbl_barang.id_merk
like '%$merk%' ORDER BY kd_brg
DESC limit $awal, $perhalaman";
$query_jumlah = "select
count(*) from tbl_barang";
}
else
{

$total_halaman
= ceil($r[0] / $perhalaman);
// bentuk
halaman, di sini intinya
$halaman_str =
""; // kosongkan variabel

if ($halaman >
0)
{
$hal =
$halaman - 1;

include"../config.php";
$sql =
"SELECT
tbl_barang.*,
kategori.id_kategori,
kategori.nama_kategori,
merk.id_merk,
merk.nama_merk
FROM tbl_barang
INNER JOIN
kategori
ON
(kategori.id_kategori =
tbl_barang.id_kategori)
INNER JOIN merk
ON
(merk.id_merk = tbl_barang.id_merk)
ORDER BY kd_brg
DESC limit $awal, $perhalaman";
$query_jumlah = "select
count(*) from tbl_barang";
}
$hasil =
mysql_query($sql, $id_mysql);
$rs_jumlah =
mysql_query($query_jumlah) or
die(mysql_error());
$r =
mysql_fetch_row($rs_jumlah);// ambil
jumlah total data
// hitung total
halaman

$halaman_str .= "<a
href='home.php?page=data.php&amp;ha
l=$hal' title='Halaman
sebelumnya'>[Prev]</a> ";
}
// ambil semua
nomor halaman
for ($i = 0; $i <
$total_halaman; $i++)
{
$hal =
$i + 1;
if ($i
== $halaman) // jika halaman aktif,
tidak usah diberi link
$halaman_str .= "$hal ";
else
$halaman_str .= "<a
href='home.php?page=data.php&amp;ha
l=$i' title='Halaman $hal'>$hal</a> ";
}
// jika bukan
berada pada halaman terakhir
if ($halaman <
($total_halaman - 1))
{
$hal =
$halaman + 1;
$halaman_str .= "<a
href='home.php?page=data.php&amp;ha
l=$hal' title='Halaman
berikutnya'>[Next]</a> ";

}
case "5" : $hari="Jumat";break;
// bentuk format
halaman
$halaman_str =
"<div
id='halaman'>$halaman_str</div>\n";
$jumlah = 1;
while($baris =
mysql_fetch_array($hasil))
{

case "6" : $hari="Sabtu";break;


}
switch
($bulan ) {
case "1" :
$bulan="Januari";break;
case "2" :
$bulan="Februari";break;

if($jumlah % 2 == 1)
{
echo"<tr bgcolor='#FFF9EA'

case "3" :
$bulan="Maret";break;

>";
}
else
{
echo"<tr class='df2'>";

case "4" : $bulan="April";break;


case "5" : $bulan="Mei";break;
case "6" : $bulan="Juni";break;

}
case "7" : $bulan="Juli";break;
include("../config.php");

case "8" :
$bulan="Agustus";break;

$id=$baris['kd_brg'];
$pecahTanggal = explode("-",
$baris['tgl_masuk']);
$tanggal = $pecahTanggal[2];
$bulan
= $pecahTanggal[1];
$tahun
= $pecahTanggal[0];
switch
($tanggal)
{
case "0" :
$hari="Minggu";break;

case "9" :
$bulan="September";break;
case "10" :
$bulan="Oktober";break;
case "11" :
$bulan="November";break;
case "12" :
$bulan="Desember";break;
}
$indDate="$tanggal $bulan
$tahun ";

case "1" : $hari="Senin";break;


case "2" : $hari="Selasa";break;

echo
"<td align='center' valign='top'
>",$jumlah ,"</td>";
echo

case "3" : $hari="Rabu";break;


case "4" : $hari="Kamis";break;

"<td align='left' valign='top'


>",$baris['kd_brg'] ,"</td>";

echo
"<td align='left' valign='top'
>",$baris['nm_brg'],"</td>";
echo
"<td align='left' valign='top'
>",$baris['nama_kategori'],"</td>";
echo
"<td align='left' valign='top'
>",$baris['nama_merk'],"</td>";
echo
"<td align='left' valign='top'
>",$baris['harga'],"</td>";
echo
"<td align='left' valign='top'
>",$baris['stok'],"</td>";
echo
"<td align='left' valign='top'
>",$indDate,"</td>";
echo
"<td align='center' valign='top' ><a
href='home.php?page=data_aksi.php&a
mp;aksi=delete&kd_brg=",$baris['kd_br
g'],"'>Hapus</a></td>";
echo
"<td align='center' valign='top'><a
href='?page=data_aksi.php&amp;aksi=e
dit&kd_brg=",$baris['kd_brg'],"'>Edit</
a></td>";
echo
"<td align='center' valign='top'><a
href='?page=data_detail.php&amp;kd_b
rg=",$baris['kd_brg'],"'>Detil</a></td>"
;
echo"</tr>";
$jumlah++;
}
echo
"<tr>
<th
colspan = '12'
bgcolor='#FEEBC5'>Halaman",
$halaman_str, "</th>
</tr >";
include"../config.php";
mysql_close($id_mysql);
?> </p>
</table>
</font>

</div>
</div>
<!-- end of center content --><!-- end of
right content -->
</div>