Institutional Repository | Satya Wacana Christian University: Perancangan Sistem Informasi Usaha Jual Pintu dan Jendela Rumah Berbasis Web

(1)

LAMPIRAN

1.

Kode Program

Kode Program 1 Kode halaman register

<?php

session_start();

if(isset($_POST['submit'])){

if(strcmp($_SESSION['code'], $_POST['code']) != 0)

{

echo "<div class=heading><img

src=images/gagal.png width=50 height=50><h2>Maaf, kode captcha salah.</h2></div><br>";

echo "<h3><a

href=javascript:self.history.back();><input name=buttonsreg value=Kembali></a>Kembali ke form registrasi.</h3>";

}else{ ?> <?php

include("koneksi.php"); //koneks ke server/host MySql $link = mysql_connect($host, $db_user, $db_pass)

or die ("Could not connect to mysql because ".mysql_error());

// pilih database mysql_select_db($dbase)

or die ("could not select database because ".mysql_error());

// cek kesamaan username $check = "select id from user where username =

'".$_POST['username']."';";

$qry = mysql_query($check) or die ("Could not match data because ".mysql_error());

$num_rows = mysql_num_rows($qry);

if ($num_rows !=0) {

echo "<div class=heading><img src=images/gagal.png width=50 height=50><h2>Maaf, Username '".$_POST['username']."' sudah ada.</h2></div><br>";

echo "<h3><a href=javascript:self.history.back();><input name=buttonsreg value=Kembali></a>Kembali ke form registrasi.</h3>";}

if(empty($num_rows)){

// cek kesamaan email

$check2 = "select id from user where email = '".$_POST['email']."';";


(2)

$qry2 = mysql_query($check2) or die ("Could not match data because ".mysql_error());

$num_rows2 = mysql_num_rows($qry2);

if ($num_rows2 !=0) {

echo "<div class=heading><img src=images/gagal.png width=50 height=50><h2>Maaf, Email '".$_POST['email']."' sudah ada.</h2></div><br>";

echo "<h3><a href=javascript:self.history.back();><input name=buttonsreg value=Kembali></a>Kembali ke form registrasi.</h3>";

} if(empty($num_rows2)){

// masukkan data

$insert = mysql_query("INSERT INTO user values

('NULL','".$_POST['username']."','".$_POST['password ']."','".$_POST['email']."','user',NOW(),'".$_POST['namalen gkap']."','".$_POST['alamatlengkap']."','".$_POST['no_telp' ]."','".$_POST['jeniskelamin']."')")

or die("<h5>404 Error</h5>"); //tampilkan pesan sukses echo "<div class=heading><img src=images/berhasil.png width=40 height=60><h2>Selamat! Akun Anda Telah Selesai Dibuat.</h2></div><br>";

echo "<h5>Berikut data yang telah anda buat :<br>";

echo "<hr color=orange><br>"; echo "Username : <i>

".$_POST['username']."</i></i><br>"; echo "Password : <i>".$_POST['password']."</i><br>";

echo "Email : <i>".$_POST['email']."</i><br>";

echo "Nama Lengkap : <i>".$_POST['namalengkap']."</i><br>";

echo "Alamat Lengkap : <i>".$_POST['alamatlengkap']."</i><br>";

echo "No. Telpon : <i>+62".$_POST['no_telp']."</i><br>";

echo "Jenis Kelamin : <i>".$_POST['jeniskelamin']."</i></h5></i><br>";

echo "<hr color=orange><br>";

echo "<h6><i>*Harap diingat data anda untuk login.</i></h6><br>";

} }?> <?php }}


(3)

Kode Program 2 Kode halaman login.php

<?php

require("koneksi.php"); if (isset($_POST['login'])) {

$username = $_POST['username'];

$password = $_POST['password'];

$result = mysql_query("SELECT * FROM user WHERE username = '$username' AND password = '$password'");

if (!$result) {

header("location:login.html"); }

$numberOfRows = MYSQL_NUMROWS($result);

If ($numberOfRows == 0) {

echo "<script>alert('Maaf, tidak ada username

".$_POST['username']." dengan password tersebut.'); window.location='login.html';</script> <br>";

}

else if ($numberOfRows > 0) {

session_start(); $_SESSION['loggedin'] = $username;

$query = mysql_query("SELECT * FROM user WHERE username = '$username'") or die (mysql_error());

$display = mysql_fetch_array($query);

$type= $display['status']; if ($type=="Admin"){

header("location:admin/index.php"); }

else{

header("location:home.php"); }

} }


(4)

Kode Program 3 Kode halaman logout.php

Kode Program 4 Kode halaman simpanorder.php

<?php session_start();?>

<?php

include("koneksi.php");

$username = $_SESSION['loggedin'];

$query = mysql_query("SELECT * FROM user WHERE username = '$username'") or die (mysql_error());

$display = mysql_fetch_array($query);

$password = $display['password'];

$sql = "DELETE FROM user_logged WHERE username = '$username' AND password = '$password'";

$add_member = mysql_query($sql);

?> <?php

header("location:index.html"); unset($_SESSION['loggedin']); ?>

<?php

$con = mysql_connect("localhost","root",""); if (!$con)

{

die('Could not connect: ' . mysql_error()); }

mysql_select_db("db_belanjakusen") or die(mysql_error()); function clean($str) {

$str = @trim($str);

if(get_magic_quotes_gpc()) { $str = stripslashes($str); }

return mysql_real_escape_string($str); }

$username = clean($_GET['username']);

$namalengkap = clean($_GET['namalengkap']); $jeniskayu = clean($_GET['jeniskayu']); $kode_kusen = clean($_GET['kode_kusen']); $nama_order = clean($_GET['nama_order']); $lebar = clean($_GET['lebar']);

$panjang = clean($_GET['panjang']); $tebal = clean($_GET['tebal']);


(5)

Kode Program 5 Kode halaman simpanubahan.php

$luas = clean($_GET['luas']);

$totalharga = clean($_GET['totalharga']); $gmbr_kusen = clean($_GET['gmbr_kusen']); $jumlah = clean($_GET['jumlah']);

$status = clean($_GET['status']);

$check = "SELECT id FROM tbl_barang WHERE kode_kusen = '$kode_kusen' AND jeniskayu = '$jeniskayu' AND username = '$username'";

$qry = mysql_query($check) or die ("Could not match data because ".mysql_error());

$num_rows = mysql_num_rows($qry);

if ($num_rows !=0) { echo '<script

type="text/javascript">alert("Maaf, kusen dengan kode '.$kode_kusen.' dan jenis kayu '.$jeniskayu.' sudah anda pesan. Silahkan anda menuju ke Daftar Order untuk mengubah data kusen anda.");

window.location="daftar_order.php";</script> <br>'; }else{

$sql = "INSERT INTO tbl_barang SET username ='$username', namalengkap='$namalengkap', jeniskayu='$jeniskayu', kode_kusen='$kode_kusen', nama_order='$nama_order', lebar='$lebar', panjang='$panjang', tebal='$tebal', luas='$luas', totalharga='$totalharga',

tgl_order=CURRENT_TIMESTAMP, gmbr_kusen='$gmbr_kusen', jumlah='$jumlah', status='$status'";

mysql_query("SELECT id FROM tbl_barang WHERE username='$username'");

if (!mysql_query($sql,$con)) {

die('Error: ' . mysql_error()); }

header("location: daftar_order.php"); }

exit();

mysql_close($con) ?>

<?php

$con = mysql_connect("localhost","root",""); if (!$con)

{

die('Could not connect: ' . mysql_error()); }

mysql_select_db("db_belanjakusen") or die(mysql_error()); function clean($str) {


(6)

Kode Program 6 Kode halaman batalpemesanan.php

$str = @trim($str);

if(get_magic_quotes_gpc()) { $str = stripslashes($str); }

return mysql_real_escape_string($str); }

$id = clean($_GET['id']);

$username = clean($_GET['username']);

$namalengkap = clean($_GET['namalengkap']); $jeniskayu = clean($_GET['jeniskayu']); $kode_kusen = clean($_GET['kode_kusen']); $lebar = clean($_GET['lebar']);

$panjang = clean($_GET['panjang']); $tebal = clean($_GET['tebal']); $luas = clean($_GET['luas']);

$totalharga = clean($_GET['totalharga']); $cat_plitur = clean($_GET['cat_plitur']); $gmbr_kusen = clean($_GET['gmbr_kusen']); $jumlah = clean($_GET['jumlah']);

$status = clean($_GET['status']);

$sql = "UPDATE tbl_barang SET username ='$username', namalengkap='$namalengkap', jeniskayu='$jeniskayu', kode_kusen='$kode_kusen', lebar='$lebar',

panjang='$panjang', tebal='$tebal', luas='$luas', totalharga='$totalharga', cat_plitur='$cat_plitur', tgl_order=NOW(), gmbr_kusen='$gmbr_kusen',

jumlah='$jumlah', status='$status' WHERE id='$id' AND username ='$username'";

mysql_query("SELECT id FROM tbl_barang WHERE username='$username'");

if (!mysql_query($sql,$con)) {

die('Error: ' . mysql_error()); }

header("location: daftar_order.php"); exit();

mysql_close($con) ?>

<?php

include('koneksi.php'); $id=$_GET['id'];

mysql_query("DELETE FROM tbl_barang WHERE id='$id'"); header('location:daftar_order.php');


(7)

Kode Program 7 Kode halaman bantuan.php

<?php

$username = $_SESSION['loggedin'];

$query = "SELECT *,UNIX_TIMESTAMP() - date_created AS TimeSpent FROM komentar_bantuan WHERE username

='$username' ORDER BY date_created DESC "; $result = mysql_query($query);

while($row = mysql_fetch_assoc($result)) {include('indo-date2.php');

//==========user============== $user = $row['username'];

$q = mysql_query("SELECT * FROM user WHERE username = '$user'") or die (mysql_error());

$dis = mysql_fetch_array($q);

$username = $_SESSION['loggedin']; if($user == $username){

echo '<h3><th

style="background:#328aa4 repeat-x;color:#fff;"><font style="color:#fff;">';

echo '<img src="images/user.png" width="30px" style="border:none;">';

echo $row['namalengkap']; echo '&nbsp; : ';

echo '</font>'; echo '</th></tr>'; }

$content= $row['komentar'];

echo '<tr><td><p style="color: #000;">' . wordwrap($content, 8, "\n", true) . '</p>';

echo '<font style="color:#000099;font-size: 15px;">';

echo $hari.', '.$tgl.' '.$bln.' '.$thn.' <i class="fa fa-clock-o fa-fw"></i> jam '.$jam;

echo '</font></h3></td></tr>'; }

?>

<?php

$username = $_SESSION['loggedin'];

$query = "SELECT *,UNIX_TIMESTAMP() - date_created AS TimeSpent FROM komentar_bantuan_admin WHERE username ='$username' ORDER BY date_created DESC ";

$result = mysql_query($query);

while($row = mysql_fetch_assoc($result)) {

//==========user============== $user = $row['username'];

$q = mysql_query("SELECT * FROM user WHERE username = '$user'") or die (mysql_error());


(8)

Kode Program 8 Kode halaman simpan_pertanyaan.php

$username = $_SESSION['loggedin'];

if($user == $username){

echo '<h3><th style="background:#E65C47 repeat-x;color:#fff;"><font style="color:#fff;">';

echo '<img src="images/admin.png" width="30px" style="border:none;">';

echo 'Admin'; echo '&nbsp; : '; echo '</font>'; echo '</th></tr>'; }

$content= $row['komen'];

echo '<tr><td><p style="color: #000;">' . wordwrap($content, 8, "\n", true) . '</p>';

echo '<font style="color:#000099;font-size: 15px;">';

echo $hari.', '.$tgl.' '.$bln.' '.$thn.' <i class="fa fa-clock-o fa-fw"></i> jam '.$jam;

echo '</font></h3></td></tr>'; }

?>

<?php

$con = mysql_connect("localhost","root",""); if (!$con)

{

die('Could not connect: ' . mysql_error()); }

mysql_select_db("db_belanjakusen") or die(mysql_error()); function clean($str) {

$str = @trim($str);

if(get_magic_quotes_gpc()) { $str = stripslashes($str); }

return mysql_real_escape_string($str); }

$username = clean($_GET['username']);

$namalengkap = clean($_GET['namalengkap']); $status = clean($_GET['status']);

$komentar = clean($_GET['komentar']);

$sql = "INSERT INTO komentar_bantuan SET username

='$username', namalengkap='$namalengkap', status='$status', komentar='$komentar', date_created='".strtotime(date("Y-m-d H:i:s"))."'";

mysql_query("SELECT * FROM komentar_bantuan WHERE username='$username'");


(9)

Kode Program 9 Kode halaman admin daftaruser.php

if (!mysql_query($sql,$con))

{

die('Error: ' . mysql_error()); }

header("location: bantuan.php"); exit();

mysql_close($con) ?>

<div id="container">

<div id="content">

<table cellspacing="0" cellpadding="0"> <tr>

<th width="30"><input type="checkbox" id ="chckHead"/></th> <th width="9%">Username</th>

<th>Password</th>

<th width="16%">Email</th> <th>Nama Lengkap</th> <th>Alamat Lengkap</th> <th>Jenis Kelamin</th> <th>No. Telp Aktif</th> <th>Tanggal Registrasi</th> <th width="14%">Opsi</th> </tr>

</table> </div> </div>

<?php

include("../koneksi.php"); $user = $_SESSION['loggedin'];

$query = mysql_query("SELECT * FROM user WHERE status = 'user' ORDER BY id DESC") or die (mysql_error()); while($list = mysql_fetch_array($query)){

?>

<div id="container">

<div id="content">

<table cellspacing="0" cellpadding="0"> <tr>

<td width="30"><input type="checkbox" class = "chcktbl" /></td>

<td width="9%"><?php echo $list['username'] ; ?></td> <td><?php echo $list['password'] ; ?></td>

<td width="16%"><?php echo $list['email'] ; ?></td> <td><?php echo $list['namalengkap'] ; ?></td>


(10)

Kode Program 10 Kode halaman admin daftarusersimpan.php

<td><?php echo $list['alamatlengkap'] ; ?></td> <td><?php echo $list['jeniskelamin'] ; ?></td> <td>+62<?php echo $list['no_telp'] ; ?></td> <td><?php echo date('d F Y ',

strtotime($list['tanggal_regristasi'])); ?></td>

<td width="15%"><div class="contact-form"><a href="daftaruseredit.php<?php echo

'?nama='.$list['username']; ?>">

<input type="submit" name="subdel" value="Ubah" /></a> <input type="submit" name="subdel" value="Hapus" onclick='$.msgbox("<h3><img

src=../images/images_msgbox/question.png

width=90>&nbsp;&nbsp;<p align=left>Hapus user <b><?php echo $list['namalengkap']; ?> </b>ini?</p></h3>", {type:

"confirm",buttons : [{type: "submit", value: "Ya"},{type: "cancel", value: "Batal"}]}, function(result) {if (result) {window.location="daftaruserdelete.php?id=<?php echo $list['id']; ?>";} });'></div></td><hr>

</tr>

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

<?php

include('../koneksi.php'); if (isset($_POST['submit'])){ $username = $_POST['username'];

$password = $_POST['password']; $email = $_POST['email'];

$namalengkap = $_POST['namalengkap']; $alamatlengkap = $_POST['alamatlengkap'];

$notelp = $_POST['no_telp'];

$jeniskelamin = $_POST['jeniskelamin'];

mysql_query("UPDATE user SET username ='$username', password='$password', email='$email',

namalengkap='$namalengkap', alamatlengkap='$alamatlengkap', no_telp='$notelp', jeniskelamin='$jeniskelamin' WHERE username = '$username' ");

header('location: daftaruser.php'); }


(11)

Kode Program 11 Kode halaman admin daftaruserdelete.php

Kode Program 12 Kode halaman admin daftarorder.php

<?php

include('../koneksi.php'); $id=$_GET['id'];

mysql_query("DELETE FROM user WHERE id='$id'"); header('location:daftaruser.php');

?>

<div id="container">

<div id="content">

<table cellspacing="0" cellpadding="0"> <tr>

<?php

include("../koneksi.php"); $user = $_SESSION['loggedin'];

$query = mysql_query("SELECT * FROM tbl_barang") or die (mysql_error());

while($list = mysql_fetch_array($query)){ }?>

<td width="5%" style="float:left;"><a

href="daftarorder2.php<?php echo '?id='.$list['id']; ?>"><img src="images/delete.png" width="30"></a></td> </tr>

</table> </div> </div>

<div id="container">

<div id="content">

<table cellspacing="0" cellpadding="0"> <tr>

<th width="30"><input type="checkbox" id ="chckHead"/></th> <th>Nama</th>

<th>Jumlah Order</th> <th>Status</th> <th>Tanggal</th> <th>Opsi</th> </tr>


(12)

</div> </div> <?php

include("../koneksi.php"); $user = $_SESSION['loggedin'];

$query = mysql_query("SELECT COUNT(*),username, id, namalengkap, status, tgl_order FROM tbl_barang GROUP BY username ORDER BY id DESC") or die (mysql_error()); while($list = mysql_fetch_array($query)){

include('../indo-date.php');?> <div id="container">

<div id="content">

<table cellspacing="0" cellpadding="0"> <tr>

<td width="30"><input type="checkbox" class = "chcktbl" /></td>

<td><?php echo $list['namalengkap'] ; ?></td> <td><?php echo $list['COUNT(*)'] ; ?></td> <td><?php echo $list['status'] ; ?>..</td>

<td><?php echo $hari.', '.$tgl.' '.$bln.' '.$thn.'<br>jam '.$jam; ?></td>

<td><div class="contact-form"><a href="daftarorder2.php<?php echo

'?nama='.$list['username']; ?>"><input type="submit" name="subdel" value="Detail" /></a>

<input type="submit" name="subdel" value="Hapus" onclick='$.msgbox("<h3><img

src=../images/images_msgbox/question.png width=90><p align=left>Hapus order dari <b><?php echo

$list['namalengkap']; ?> </b>?</h3>", {type:

"confirm",buttons : [{type: "submit", value: "Ya"},{type: "cancel", value: "Batal"}]}, function(result) {if (result) {window.location="daftarorderdelete.php?id=<?php echo $list['id']; ?>";} });'></p></div></td><hr>

</tr>

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


(13)

Kode Program 13 Kode halaman admin detail_daftarorder.php

<div id="container">

<div id="content">

<table cellspacing="0" cellpadding="0"> <tr>

<th>Kode Kusen</th> <th>Panjang</th> <th>Lebar</th> <th>Tebal</th> <th>Luas</th> <th>Jenis Kayu</th> <th>Jumlah</th> <th>Total Harga</th>

<th width="20%">Status</th> <th>Tanggal</th>

</tr> </table> </div> </div> <?php

include("../koneksi.php"); $username = $_GET['nama']; $user = $_SESSION['loggedin'];

$query = mysql_query("SELECT COUNT(*), id, username, namalengkap, status, tgl_order, kode_kusen, panjang, lebar, tebal, luas, jeniskayu, jumlah, totalharga FROM tbl_barang WHERE username='$username' GROUP BY kode_kusen ORDER BY id DESC") or die (mysql_error());

while($list = mysql_fetch_array($query)){ include('../indo-date.php'); ?>

<div id="container">

<div id="content">

<table cellspacing="0" cellpadding="0"> <tr>

<td><?php echo $list['kode_kusen'] ; ?></td> <td><?php echo $list['panjang'] ; ?> cm</td> <td><?php echo $list['lebar'] ; ?> cm</td> <td><?php echo $list['tebal'] ; ?> cm</td> <td><?php echo $list['luas'] ; ?> cm2</td> <td><?php echo $list['jeniskayu'] ; ?></td> <td><?php echo $list['jumlah'] ; ?></td>

<td>Rp. <?php echo $list['totalharga'] ; ?></td> <div class="contact-form">


(14)

<form method="post" action="daftarordersubmit.php"> <input type="hidden" name="username" value="<?php echo $list['username']; ?>">

<input type="hidden" name="kode_kusen" value="<?php echo $list['kode_kusen']; ?>">

<td width="20%">

<select name="status" value="<?php echo $list['status'] ?>" style ="width:150px">

<?php

if ($list['status']=="Menunggu Respon"){

echo '<option value="Menunggu Respon"> Menunggu Respon'; echo '<option value="Silahkan Kirim Deposit 50%"> Silahkan Kirim Deposit 50%';

echo '<option value="Siap Dikirim"> Siap Dikirim';} else if ($list['status']=="Silahkan Kirim Deposit 50%"){ echo '<option value="Silahkan Kirim Deposit 50%"> Silahkan Kirim Deposit 50%';

echo '<option value="Menunggu Respon"> Menunggu Respon'; echo '<option value="Siap Dikirim"> Siap Dikirim'; }

else if ($list['status']=="Siap Dikirim"){

echo '<option value="Siap Dikirim"> Siap Dikirim'; echo '<option value="Menunggu Respon"> Menunggu Respon'; echo '<option value="Silahkan Kirim Deposit 50%">Silahkan Kirim Deposit 50%';

} ?> </select> </td>

<td><?php echo $hari.', '.$tgl.' '.$bln.' '.$thn; ?></td></div>

</tr> </table>

<div class="contact-form"><div class="buttons6"><input type="submit" name="subdel" value="Update"

style="width50%;" /> </form>

<input type="submit" name="subdel" value="Hapus" onclick='$.msgbox("<h3><img

src=../images/images_msgbox/question.png width=90><p align=left>Hapus order dari <b><?php echo

$list['namalengkap']; ?> </b> dengan kode <b><?php echo $list['kode_kusen']; ?> </b>?</p></h3>", {type:

"confirm",buttons : [{type: "submit", value: "Ya"},{type: "cancel", value: "Batal"}]}, function(result) {if (result) {window.location="daftarorderdelete.php?id=<?php echo $list['id']; ?>";} });' style="width:50%;">

</div></div><hr><br> </div>

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


(15)

Kode Program 14 Kode halaman admin daftarordersubmit.php

Kode Program 15 Kode halaman admin daftarorderdelete.php

Kode Program 16 Kode halaman admin daftarkomen.php

<?php

include("../koneksi.php"); if (isset($_POST['subdel'])){

$username = $_POST['username']; $statusedit=$_POST['status']; $kodekus = $_POST['kode_kusen'];

mysql_query("UPDATE tbl_barang SET status='$statusedit' WHERE kode_kusen='$kodekus' AND username='$username'"); header('location:daftarorder.php');

} ?>

<?php

include('../koneksi.php'); $id=$_GET['id'];

mysql_query("DELETE FROM tbl_barang WHERE id='$id'"); header('location:daftarorder.php');

?>

<div id="container"> <div id="content">

<table cellspacing="0" cellpadding="0"> <tr>

<th width="30"><input type="checkbox" id ="chckHead"/></th> <th>Nama</th>

<th>Jumlah Pertanyaan</th> <th>Tanggal</th>

<th>Opsi</th> </tr>

</table> </div> </div>


(16)

Kode Program 17 Kode halaman admin daftarkomensimpan.php

<?php

include("../koneksi.php"); $user = $_SESSION['loggedin'];

$query = mysql_query("SELECT COUNT(*), UNIX_TIMESTAMP() - date_created AS TimeSpent, username, komen_id, namalengkap, komentar, date_created FROM komentar_bantuan GROUP BY username ORDER BY komen_id DESC") or die (mysql_error()); while($list = mysql_fetch_array($query)){

include('../indo-date5.php'); ?>

<div id="container"> <div id="content">

<table cellspacing="0" cellpadding="0"> <tr>

<td width="30"><input type="checkbox" class = "chcktbl" /></td>

<td><?php echo $list['namalengkap'] ; ?></td> <td><?php echo $list['COUNT(*)'] ; ?></td>

<td><?php echo $hari.', '.$tgl.' '.$bln.' '.$thn.' <i class="fa fa-clock-o fa-fw"></i> jam '.$jam; ?></td> <td><div class="contact-form"><a

href="daftarkomendetail.php<?php echo

'?nama='.$list['username']; ?>"><input type="submit" name="subdel" value="Detail" /></a>

<input type="submit" name="subdel" value="Hapus" onclick='$.msgbox("<h3><img

src=../images/images_msgbox/alert.png width=90><p align=left>Hapus order dari <b><?php echo

$list['namalengkap']; ?> </b>?</h3>", {type:

"confirm",buttons : [{type: "submit", value: "Ya"},{type: "cancel", value: "Batal"}]}, function(result) {if (result) {window.location="daftarkomendelete.php?id=<?php echo $list['komen_id']; ?>";} });'></p></div>

</tr> <hr> </table> </div> </div> <?php }?> </div> </div>

<?php

$con = mysql_connect("localhost","root",""); if (!$con)

{

die('Could not connect: ' . mysql_error()); }


(17)

Kode Program 18 Kode halaman admin daftarkomendelete.php

mysql_select_db("db_belanjakusen") or die(mysql_error()); function clean($str) {

$str = @trim($str);

if(get_magic_quotes_gpc()) { $str = stripslashes($str); }

return mysql_real_escape_string($str); }

$username = clean($_GET['username']);

$komen = clean($_GET['komentar']);

$sql = "INSERT INTO komentar_bantuan_admin SET username ='$username', komen='$komen',

date_created='".strtotime(date("Y-m-d H:i:s"))."'";

mysql_query("SELECT * FROM komentar_bantuan_admin WHERE username='$username'");

if (!mysql_query($sql,$con)) {

die('Error: ' . mysql_error()); }

header("location: daftarkomendetail.php?nama=$username"); exit();

mysql_close($con) ?>

<?php

include('../koneksi.php'); $id=$_GET['id'];

mysql_query("DELETE FROM komentar_bantuan_admin WHERE id='$id' ");

header("location: daftarkomen.php"); ?>


(18)

Kode Program 19 Kode halaman admin tips-simpan.php

Kode Program 20 Kode halaman admin tips-hapus.php

<?php ob_start(); ?>

<?php session_start();

if (!isset($_FILES['gambar']['tmp_name'])) { echo "";

}else{

$file=$_FILES['gambar']['tmp_name']; $image=

addslashes(file_get_contents($_FILES['gambar']['tmp_name']) );

$image_name= addslashes($_FILES['gambar']['name']); $image_size= getimagesize($_FILES['gambar']['tmp_name']);

if ($image_size=FALSE) {

echo "You have entered an invalid file!";

}else{

include('../koneksi.php'); if (isset($_POST['submit'])){

if (empty($_FILES['gambar']['tmp_name'])) { $location="";

}else{

move_uploaded_file($_FILES["gambar"]["tmp_name"],"images/ti ps/" . $_FILES["gambar"]["name"]);

$location="images/tips/" . $_FILES["gambar"]["name"]; }

$image = $location; $judul = $_POST['judul']; $isi = $_POST['isi'];

mysql_query("INSERT INTO tips SET judul='$judul',

isi='$isi', gambar='$image', tanggal=CURRENT_TIMESTAMP "); header('location:tips.php');

} }

} ?>

<?php ob_flush(); ?>

<?php

include('../koneksi.php'); $id=$_GET['tips'];

mysql_query("DELETE FROM tips WHERE id_tips='$id'"); header('location:tips.php');


(19)

(1)

<form method="post" action="daftarordersubmit.php"> <input type="hidden" name="username" value="<?php echo $list['username']; ?>">

<input type="hidden" name="kode_kusen" value="<?php echo $list['kode_kusen']; ?>">

<td width="20%">

<select name="status" value="<?php echo $list['status'] ?>" style ="width:150px">

<?php

if ($list['status']=="Menunggu Respon"){

echo '<option value="Menunggu Respon"> Menunggu Respon'; echo '<option value="Silahkan Kirim Deposit 50%"> Silahkan Kirim Deposit 50%';

echo '<option value="Siap Dikirim"> Siap Dikirim';} else if ($list['status']=="Silahkan Kirim Deposit 50%"){ echo '<option value="Silahkan Kirim Deposit 50%"> Silahkan Kirim Deposit 50%';

echo '<option value="Menunggu Respon"> Menunggu Respon'; echo '<option value="Siap Dikirim"> Siap Dikirim'; }

else if ($list['status']=="Siap Dikirim"){

echo '<option value="Siap Dikirim"> Siap Dikirim'; echo '<option value="Menunggu Respon"> Menunggu Respon'; echo '<option value="Silahkan Kirim Deposit 50%">Silahkan Kirim Deposit 50%';

} ?> </select> </td>

<td><?php echo $hari.', '.$tgl.' '.$bln.' '.$thn; ?></td></div>

</tr> </table>

<div class="contact-form"><div class="buttons6"><input type="submit" name="subdel" value="Update"

style="width50%;" /> </form>

<input type="submit" name="subdel" value="Hapus" onclick='$.msgbox("<h3><img

src=../images/images_msgbox/question.png width=90><p align=left>Hapus order dari <b><?php echo

$list['namalengkap']; ?> </b> dengan kode <b><?php echo $list['kode_kusen']; ?> </b>?</p></h3>", {type:

"confirm",buttons : [{type: "submit", value: "Ya"},{type: "cancel", value: "Batal"}]}, function(result) {if (result) {window.location="daftarorderdelete.php?id=<?php echo $list['id']; ?>";} });' style="width:50%;">

</div></div><hr><br> </div> </div> <?php }?> </div> </div>


(2)

Kode Program 14 Kode halaman admin daftarordersubmit.php

Kode Program 15 Kode halaman admin daftarorderdelete.php

Kode Program 16 Kode halaman admin daftarkomen.php

<?php

include("../koneksi.php"); if (isset($_POST['subdel'])){ $username = $_POST['username']; $statusedit=$_POST['status']; $kodekus = $_POST['kode_kusen'];

mysql_query("UPDATE tbl_barang SET status='$statusedit' WHERE kode_kusen='$kodekus' AND username='$username'"); header('location:daftarorder.php');

} ?>

<?php

include('../koneksi.php'); $id=$_GET['id'];

mysql_query("DELETE FROM tbl_barang WHERE id='$id'"); header('location:daftarorder.php');

?>

<div id="container"> <div id="content">

<table cellspacing="0" cellpadding="0"> <tr>

<th width="30"><input type="checkbox" id ="chckHead"/></th> <th>Nama</th>

<th>Jumlah Pertanyaan</th> <th>Tanggal</th>

<th>Opsi</th> </tr>

</table> </div> </div>


(3)

Kode Program 17 Kode halaman admin daftarkomensimpan.php

<?php

include("../koneksi.php"); $user = $_SESSION['loggedin'];

$query = mysql_query("SELECT COUNT(*), UNIX_TIMESTAMP() - date_created AS TimeSpent, username, komen_id, namalengkap, komentar, date_created FROM komentar_bantuan GROUP BY username ORDER BY komen_id DESC") or die (mysql_error()); while($list = mysql_fetch_array($query)){

include('../indo-date5.php'); ?>

<div id="container"> <div id="content">

<table cellspacing="0" cellpadding="0"> <tr>

<td width="30"><input type="checkbox" class = "chcktbl" /></td>

<td><?php echo $list['namalengkap'] ; ?></td> <td><?php echo $list['COUNT(*)'] ; ?></td>

<td><?php echo $hari.', '.$tgl.' '.$bln.' '.$thn.' <i class="fa fa-clock-o fa-fw"></i> jam '.$jam; ?></td> <td><div class="contact-form"><a

href="daftarkomendetail.php<?php echo

'?nama='.$list['username']; ?>"><input type="submit" name="subdel" value="Detail" /></a>

<input type="submit" name="subdel" value="Hapus" onclick='$.msgbox("<h3><img

src=../images/images_msgbox/alert.png width=90><p align=left>Hapus order dari <b><?php echo

$list['namalengkap']; ?> </b>?</h3>", {type:

"confirm",buttons : [{type: "submit", value: "Ya"},{type: "cancel", value: "Batal"}]}, function(result) {if (result) {window.location="daftarkomendelete.php?id=<?php echo $list['komen_id']; ?>";} });'></p></div>

</tr> <hr> </table> </div> </div> <?php }?> </div> </div>

<?php

$con = mysql_connect("localhost","root",""); if (!$con)


(4)

Kode Program 18 Kode halaman admin daftarkomendelete.php

mysql_select_db("db_belanjakusen") or die(mysql_error()); function clean($str) {

$str = @trim($str);

if(get_magic_quotes_gpc()) { $str = stripslashes($str); }

return mysql_real_escape_string($str); }

$username = clean($_GET['username']); $komen = clean($_GET['komentar']);

$sql = "INSERT INTO komentar_bantuan_admin SET username ='$username', komen='$komen',

date_created='".strtotime(date("Y-m-d H:i:s"))."'"; mysql_query("SELECT * FROM komentar_bantuan_admin WHERE username='$username'");

if (!mysql_query($sql,$con)) {

die('Error: ' . mysql_error()); }

header("location: daftarkomendetail.php?nama=$username"); exit();

mysql_close($con) ?>

<?php

include('../koneksi.php'); $id=$_GET['id'];

mysql_query("DELETE FROM komentar_bantuan_admin WHERE id='$id' ");

header("location: daftarkomen.php"); ?>


(5)

Kode Program 19 Kode halaman admin tips-simpan.php

Kode Program 20 Kode halaman admin tips-hapus.php

<?php ob_start(); ?>

<?php session_start();

if (!isset($_FILES['gambar']['tmp_name'])) { echo "";

}else{

$file=$_FILES['gambar']['tmp_name']; $image=

addslashes(file_get_contents($_FILES['gambar']['tmp_name']) );

$image_name= addslashes($_FILES['gambar']['name']); $image_size= getimagesize($_FILES['gambar']['tmp_name']); if ($image_size=FALSE) {

echo "You have entered an invalid file!"; }else{

include('../koneksi.php'); if (isset($_POST['submit'])){

if (empty($_FILES['gambar']['tmp_name'])) { $location="";

}else{

move_uploaded_file($_FILES["gambar"]["tmp_name"],"images/ti ps/" . $_FILES["gambar"]["name"]);

$location="images/tips/" . $_FILES["gambar"]["name"]; }

$image = $location; $judul = $_POST['judul']; $isi = $_POST['isi'];

mysql_query("INSERT INTO tips SET judul='$judul',

isi='$isi', gambar='$image', tanggal=CURRENT_TIMESTAMP "); header('location:tips.php');

} }

} ?>

<?php ob_flush(); ?>

<?php

include('../koneksi.php'); $id=$_GET['tips'];


(6)