Vous êtes sur la page 1sur 10
<?php //isi.php include "config.php"; $koneksi=koneksi_db(); $hasil=mysql_query("SELECT * FROM content

<?php //isi.php include "config.php"; $koneksi=koneksi_db(); $hasil=mysql_query("SELECT * FROM content WHERE intro='$_GET[kode_content]'"); $data=mysql_fetch_row($hasil); echo "<p class='judul'>$data[2]</p><hr>"; echo "<p class='isi'>$data[3]</p><br>";

?>

echo "<p class='isi'>$data[3]</p><br>"; ?>

<?php //produk_kanan.php $hasil=mysql_query("SELECT * FROM DVD WHERE kategori_id='$_GET[kode]'"); echo "<table>"; while($data=mysql_fetch_row($hasil))

{

echo "<tr><td><img src='./images/$data[0].jpg'></td>"; echo "<td class='isi'>JUDUL : $data[1]<br>"; echo "PEMAIN : $data[2]<br>"; echo "HARGA : $data[4]</td>";

echo "<td><a href='pesan_brg.php?status=tampil&id=$data[0]'><img border=0 src='./images/pesan_film.jpg'></a></td></tr>";

}

echo "</table>";

if($_GET[status] == "batal" or $_POST[btn]=="submit") { session_destroy();

}

?>

Produk_kiri.php <table border=0 cellspacing=2 width=185> <form action="content.php" method=post> <tr><td><img border=0 width=179 src="images/search.jpg"></td></tr>

<tr><td></td></tr> <tr><td>&nbsp;&nbsp;<input type=text name=cari size=22></td></tr> <tr><td class="isi_kiri">&nbsp;&nbsp;<input type=radio name=movie value=radio>Movie</td></tr> <tr><td class="isi_kiri">&nbsp;&nbsp;<input type=radio name=movie value=radio>Actor</td></tr> <tr><td>&nbsp;&nbsp;<input type=submit name=find value="Find"></td></tr> <tr><td></td></tr> <tr><td></td></tr> <tr><td><img border=0 width=179 src="images/kategori.jpg"></td></tr> <tr><td></td></tr> <tr><td> <?php if ($status=="batal")

{

session_unregister("kode_brg");

session_unregister("jml");

session_unregister("index");

}

include "config.php";

$koneksi=koneksi_db(); $hasil=mysql_query("SELECT * FROM Kategori"); echo "<p class='isi_kiri'>"; while ($data=mysql_fetch_row($hasil))

{

echo "&nbsp;&nbsp;<a href='produk.php?kode=$data[0]'>$data[1]</a><br>";

}

echo "</p>";

?>

</form>

</table>

</table> Pesan_brg.php <?php session_start(); include "config.php"; $koneksi=koneksi_db();

Pesan_brg.php

<?php

session_start(); include "config.php"; $koneksi=koneksi_db(); if(empty($_SESSION[kode_brg])) { $kode_brg = array(); $jml = array(); $_SESSION[kode_brg] = $kode_brg; $_SESSION[jml] = $jml;

$index=-1;

}

$index = count($_SESSION[kode_brg]); $kode_brg = $_SESSION[kode_brg]; $jml = $_SESSION[jml];

$tambah=true; for ($i=1;$i<=$index;$i++) { if ($kode_brg[$i] == $_GET[id]) { $jml[$i]=$jml[$i] + 1;

}

$tambah=false; $_SESSION[jml] = $jml;

}

if ($tambah and !empty($_GET[id]) and ! $_POST[save]) $index = count($kode_brg); $index++; $kode_brg[$index]=$_GET[id];

$jml[$index]=1;

$_SESSION[kode_brg] = $kode_brg; $_SESSION[jml] = $jml;

}

{

if ($_POST[save] == "simpan") { for($i=1;$i<=$index;$i++) { $jml[$i]=$_POST[qty][$i]; $_SESSION[jml] = $jml;

}

}

function rupiah($angka) { $rupiah = number_format($angka,0,',','.'); return $rupiah;

}

if ($_GET[status]=="tampil" or $_POST[save])

{

$jml_tot=0;

echo "<br><table cellspacing=0>"; echo "<form action='pesan_brg.php' method=post>"; echo "<tr><td width=400 bgcolor='#cccccc'>JUDUL</td>"; echo "<td width=400 bgcolor='#cccccc'>PEMAIN</td>"; echo "<td width=400 bgcolor='#cccccc'>HARGA</td>"; echo "<td width=400 bgcolor='#cccccc'>JUMLAH</td>"; echo "<td width=400 bgcolor='#cccccc'>TOTAL</td></tr>"; for ($i=1;$i<=$index;$i++)

{

 

$hasil=mysql_query("SELECT * FROM DVD WHERE kode_dvd='$kode_brg[$i]'"); $data=mysql_fetch_row($hasil); echo "<tr><td>$data[1]</td>"; echo "<td>$data[2]</td>"; echo "<td>$data[4]</td>"; echo "<td><input type=text name=qty[$i] value=$jml[$i]></td>";

$total=$data[4]*$jml[$i];

$total_rp = rupiah($total); echo "<td>Rp $total_rp </td></tr>"; $jml_tot=$jml_tot+$total; $jml_tot_rp= rupiah($jml_tot);

}

echo "<tr><td width=400 bgcolor='#cccccc'></td>";

echo "<td width=400 bgcolor='#cccccc'></td>"; echo "<td width=400 bgcolor='#cccccc'></td>"; echo "<td width=400 bgcolor='#cccccc'>JUMLAH TOTAL</td>"; echo "<td width=400 bgcolor='#cccccc'>Rp $jml_tot_rp</td></tr>"; echo "</table><br>";

}

echo "<a href='produk.php?kode=1'><img border=0 src='./images/ulangi_pesan.jpg'></a>"; echo "<a href='produk.php?kode=1&status=batal'><img border=0 src='./images/batal_pesan.jpg'></a>"; echo "<a href='customer.php'><img border=0 src='./images/beli_film.jpg'></a>";

echo "<input type=hidden name=save value=simpan> <input type=image src='./images/Simpan_Data.jpg'><br><br>";

?>

value=simpan> <input type=image src='./images/Simpan_Data.jpg'><br><br>"; ?>
Beli_customer.php <?php session_start(); $index = count($_SESSION[kode_brg]); $kode_brg = $_SESSION[kode_brg]; $jml =

Beli_customer.php

<?php

session_start(); $index = count($_SESSION[kode_brg]); $kode_brg = $_SESSION[kode_brg]; $jml = $_SESSION[jml];

include "config.php"; $koneksi=koneksi_db();

function rupiah($angka) { $rupiah = number_format($angka,0,',','.'); return $rupiah;

}

$jml_tot=0;

echo "<hr><strong>ITEM BARANG YANG MAU DIBELI</strong><hr>"; echo "<table cellspacing=0>"; echo "<tr><td width=400 bgcolor='#cccccc'>JUDUL</td>"; echo "<td width=400 bgcolor='#cccccc'>PEMAIN</td>"; echo "<td width=400 bgcolor='#cccccc'>HARGA</td>";

echo "<td width=400 bgcolor='#cccccc'>JUMLAH</td>"; echo "<td width=400 bgcolor='#cccccc'>TOTAL</td></tr>"; for ($i=1;$i<=$index;$i++)

{

 

$hasil=mysql_query("SELECT * FROM DVD WHERE kode_dvd='$kode_brg[$i]'"); $data=mysql_fetch_row($hasil); echo "<tr><td>$data[1]</td>"; echo "<td>$data[2]</td>"; echo "<td>$data[4]</td>"; echo "<td>$jml[$i]</td>";

$total=$data[4]*$jml[$i];

$total_rp = rupiah($total); echo "<td>Rp $total_rp </td></tr>"; $jml_tot=$jml_tot+$total; $jml_tot_rp= rupiah($jml_tot);

}

echo "<tr><td width=400 bgcolor='#cccccc'></td>"; echo "<td width=400 bgcolor='#cccccc'></td>"; echo "<td width=400 bgcolor='#cccccc'></td>"; echo "<td width=400 bgcolor='#cccccc'>JUMLAH TOTAL</td>"; echo "<td width=400 bgcolor='#cccccc'>$jml_tot</td></tr>"; echo "</table><br><hr>";

?> <?php if (!($_POST[btn]=="submit")) { $kode_cust = rand(000,999); echo "

<strong>DATA ANDA</strong><hr> <form method=post> <table> <tr><td>Nama </td><td><input type=text name=cust></td></tr> <tr><td>Alamat</td><td><input type=text name=alamat></td></tr> <tr><td>Kota</td><td><input type=text name=kota></td></tr> <tr><td>No Telpon/HP</td><td><input type=text name=hp></td></tr> <tr><td>Email</td><td><input type=text name=email></td></tr> <tr><td><input type=submit name=btn value=submit> <input type=reset name=reset></td><td></td></tr> </table> <input type='hidden' name='kode_cust' value='$kode_cust'> </form>";

}

if ($_POST[btn]=="submit")

{

$kode_cust = $_POST[kode_cust]; $cust = $_POST[cust]; $alamat = $_POST[alamat]; $kota = $_POST[kota]; $hp = $_POST[hp]; $email = $_POST[email]; date_default_timezone_set('Asia/Jakarta'); $tgl = date("Y:m:d H:i:s");

echo ""; echo " <strong>DATA ANDA SUDAH TERSIMPAN</strong><hr> <form action='produk.php?kode=1' method=post> <table> <tr><td width=150 bgcolor='#dddddd'>Nama Customer : </td><td bgcolor='#dddddd'>$cust</td></tr> <tr><td bgcolor='#eeeeee'>Alamat</td><td bgcolor='#eeeeee'>$alamat</td></tr> <tr><td bgcolor='#dddddd'>Kota</td><td bgcolor='#dddddd'>$_POST[kota]</td></tr> <tr><td bgcolor='#eeeeee'>No Telpon/HP</td><td bgcolor='#eeeeee'>$_POST[hp]</td></tr> <tr><td bgcolor='#dddddd'>Email</td><td bgcolor='#dddddd'>$_POST[email]</td></tr> <tr><td><input type=submit name=btn value=submit><td></tr> </table> KAMI AKAN ANTAR BARANG ANDA SETELAH ANDA MELAKUKAN TRANSFER KE REKENING BCA 345345435

atau MANDIRI 56546456 </form>"; $insert = mysql_query($s="INSERT INTO customer VALUES ('$kode_cust','$cust','$alamat','$kota','$hp','$email')"); if($insert) { $hasil=mysql_query("SELECT * FROM customer WHERE Nama='$cust' and Alamat='$alamat'"); $data=mysql_fetch_row($hasil);

for ($i=1;$i<=$index;$i++)

{

$kode_cust=$data[0];

$kd_brg=$kode_brg[$i]; $jumlah=$jml[$i]; $s="INSERT INTO transaksi VALUES ('$kode_cust','$kd_brg','$jumlah','$tgl')"; mysql_query($s);

}

?>

}

}