• Tidak ada hasil yang ditemukan

Institutional Repository | Satya Wacana Christian University: Perancangan Web Sistem Informasi Penjualan Kuningan dan Handicraft Berbasis PHP Responsif Adaptif serta Multi Platform

N/A
N/A
Protected

Academic year: 2017

Membagikan "Institutional Repository | Satya Wacana Christian University: Perancangan Web Sistem Informasi Penjualan Kuningan dan Handicraft Berbasis PHP Responsif Adaptif serta Multi Platform"

Copied!
33
0
0

Teks penuh

(1)

75

a.

Kode Program 1 Kode Program untuk Data Keranjang Belanja

<?php

include('../db.php'); session_start();

date_default_timezone_set('Asia/Manila'); $jim = new Shopping();

$q = $_GET['q'];

if(!isset($_SESSION['cart'])){ $_SESSION['cart'] = array(); $_SESSION['proID'] = 0;

}

if($q == 'addtocart'){

$product = $_POST['product']; $price = $_POST['price']; $qty = $_POST['qty'];

$jim->addtocart($product,$price,$qty); }else if($q == 'emptycart'){

unset($_SESSION['cart']); unset($_SESSION['proID']); header("location:../cart.php"); }else if($q == 'removefromcart'){ $id = $_GET['id'];

$jim->removefromcart($id); }else if($q == 'updatecart'){ $id = $_GET['id'];

$qty = $_POST['qty']; $jim->updatecart($id,$qty); }else if($q == 'countcart'){ $jim->countcart(); }else if($q == 'countorder'){ $jim->countorder();

}else if($q == 'countproducts'){ $jim->countproducts(); }else if($q == 'countcategory'){ $jim->countcategory(); }else if($q == 'checkout'){ $jim->checkout(); }else if($q == 'verify'){ $jim->verify(); }

/*$_SESSION['cart']; $product = 'product101'; $price ='300';

$jim->addtocart($product, $price);*/

class Shopping {

function addtocart($product, $price, $qty){ $cart = array(

'proID' => $_SESSION['proID'], 'product' => $product,

(2)

'qty' => $qty );

$_SESSION['proID'] = $_SESSION['proID'] + 1; array_push($_SESSION['cart'],$cart); return true;

}

function removefromcart($id){ $_SESSION['cart'][$id]['qty'] = 0; //print_r($_SESSION['cart'][$id]['qty']);

header("location:../cart.php"); }

function updatecart($id,$qty){

$_SESSION['cart'][$id]['qty'] = $qty; header("location:../cart.php");

}

function countcart(){ $count = 0;

$cart = isset($_SESSION['cart']) ? $_SESSION['cart']:array();

foreach($cart as $row): if($row['qty']!=0){ $count = $count + 1; }

endforeach; echo $count; }

function countorder(){

$q = "select * from dbproyek.order where status='unconfirmed'";

$result = mysql_query($q); echo mysql_num_rows($result); }

function countproducts(){

$q = "select * from dbproyek.products"; $result = mysql_query($q);

echo mysql_num_rows($result); }

function countcategory(){

$q = "select * from dbproyek.category"; $result = mysql_query($q);

echo mysql_num_rows($result); }

function checkout(){ include('../db.php');

$fname = $_POST['fname']; $lname = $_POST['lname']; $contact = $_POST['contact']; $email = $_POST['email']; $address = $_POST['address']; $fullname = $fname.' '.$lname; $date = date('m/d/y h:i:s A'); $item = '';

foreach($_SESSION['cart'] as $row): if($row['qty'] != 0){

$product = '('.$row['qty'].') '.$row['product']; $item = $product.', '.$item;

(3)

$amount = $_SESSION['totalprice'];

echo $q = "INSERT INTO dbproyek.order VALUES (NULL, '$fullname', '$contact', '$address', '$email', '$item', '$amount', 'unconfirmed', '$date', '')";

mysql_query($q);

unset($_SESSION['cart']); header("location:../success.php"); }

function verify(){

$username = $_POST['username']; $password = $_POST['password']; $q = "SELECT * from dbproyek.user where username='$username' and password='$password'"; $result = mysql_query($q);

$_SESSION['login']='yes'; echo mysql_num_rows($result); }

}

?>

Kode Program 2 Kode Program untuk Footer Menu Operator

<script src="js/jquery.js"></script>

<script src="js/bootstrap.min.js"></script>

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

$(function() {

$(".delbutton").click(function(){ var element = $(this);

var del_id = element.attr("id"); var info = 'id=' + del_id;

if(confirm("Sure you want to delete this update?))

{

$.ajax({

type: "GET",

url: "deleteprod.php",

data: info,

success: function(){

} });

$(this).parents(".record").animate({ backgroundColor:

"#fbc7c7" }, "fast")

.animate({ opacity: "hide" }, "slow"); }

return false; });

});

</script>

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

(4)

Kode Program 3 Kode Program untuk Header Menu Operator

<?php include('db.php'); ?>

<?php date_default_timezone_set('Asia/Manila'); ?> <?php

$jim = new Admin();

$p = isset($_GET['p']) ? $_GET['p'] : null; if($p == 'deliver'){

$jim->deliver(); }else if($p == 'paid'){ $jim->paid(); }else if($p == 'delete'){ $jim->delete(); }

class Admin {

function getunpaidorders(){

$q = "SELECT * FROM dbproyek.order where status='unconfirmed' order by dateOrdered desc";

$result = mysql_query($q); return $result;

}

function getdeliveredorders(){

$q = "SELECT * FROM dbproyek.order where status='delivered' order by dateDelivered desc";

$result = mysql_query($q); return $result;

}

function getpaidorders(){

$q = "SELECT * FROM dbproyek.order where status='confirmed' order by dateDelivered desc";

$result = mysql_query($q); return $result;

}

function getorder(){ $id = $_GET['id'];

$q = "SELECT * FROM dbproyek.order where id=$id"; $result = mysql_query($q);

return $result; }

function deliver(){

$date = date('m/d/y h:i:s A'); $id = $_GET['id'];

$q = "UPDATE dbproyek.order set

dateDelivered='$date', status='delivered' where id=$id"; mysql_query($q);

return true; }

function paid(){ $id = $_GET['id'];

$date = date('m/d/y h:i:s A'); $q = "UPDATE dbproyek.order set

dateDelivered='$date', status='confirmed' where id=$id"; mysql_query($q);

return true; }

function getcategory(){

(5)

asc";

$result = mysql_query($q); return $result;

}

function addcategory($cat){

$q = "INSERT INTO dbproyek.category values('','$cat')";

mysql_query($q); return true; }

function delete(){

$table = $_GET['table']; $id = $_GET['id'];

//echo $q = "DELETE FROM dbproyek.$table where id=$id";

mysql_query("DELETE FROM dbproyek.$table where id=$id");

return true; }

function getcategorybyid($id){

$q = "Select * from dbproyek.category where id=$id"; $result = mysql_query($q);

if($row = mysql_fetch_array($result)){ $category = $row['title'];

}

return $category; }

function updatecategory($cat,$id){

$q = "update dbproyek.category set title='$cat' where id=$id";

mysql_query($q); return true; }

} ?>

<!DOCTYPE html> <html lang="en"> <head>

<?php include('session.php'); ?>

<link rel="stylesheet" href="css/style1.css" type="text/css"

media="screen" charset="utf-8">

<script src="admin.js" type="text/javascript" charset= "utf-8"></script>

<script src="js/application.js" type="text/javascript"

charset="utf-8"></script>

<!--sa poip up-->

<link href="src/facebox.css" media="screen" rel="stylesheet"

type="text/css" />

<link href="css/style.css" media="screen" rel="stylesheet"

type="text/css" />

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

<script type="text/javascript"> jQuery(document).ready(function($) {

$('a[rel*=facebox]').facebox({

loadingImage : 'src/loading.gif',

closeImage : 'src/closelabel.png' })

(6)

</script>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta name="description" content="">

<meta name="author" content="">

<title>Shop | E-Shopper</title>

<link href="css/bootstrap.min.css" rel="stylesheet">

<link href="css/font-awesome.min.css" rel="stylesheet">

<link href="css/animate.css" rel="stylesheet"> <link href="css/main.css" rel="stylesheet"> <link href="css/responsive.css" rel="stylesheet">

<!--[if lt IE 9]>

<script src="js/html5shiv.js"></script> <script src="js/respond.min.js"></script> <![endif]-->

<link rel="shortcut icon" href="images/ico/favicon.ico">

<link rel="apple-touch-icon-precomposed" sizes="144x144"

href="images/ico/apple-touch-icon-144-precomposed.png">

<link rel="apple-touch-icon-precomposed" sizes="114x114"

href="images/ico/apple-touch-icon-114-precomposed.png">

<link rel="apple-touch-icon-precomposed" sizes="72x72"

href="images/ico/apple-touch-icon-72-precomposed.png">

<link rel="apple-touch-icon-precomposed"

href="images/ico/apple-touch-icon-57-precomposed.png"> </head><!--/head-->

<body>

<header id="header"><!--header-->

<div class="header_top"><!--header_top-->

<div class="container"> <div class="row">

<div class="col-sm-6"> <div

class="contactinfo">

<ul class="nav nav-pills">

<li><a href="#"><i class="fa fa-phone"></i>085727488404</a></li>

<li><a href="#"><i class="fa fa-envelope"></i>

ivanyohanes@gmail.com</a></li> </ul>

</div> </div> <div class="col-sm-6">

<div class="social-icons pull-right"> <ul class="nav navbar-nav">

<li><a href="#"><i

class="fa fa-facebook"></i></a></li> <li><a href="#"><i class="fa fa-twitter"></i></a></li>

<li><a href="#"><i class="fa fa-linkedin"></i></a></li>

<li><a href="#"><i class="fa fa-dribbble"></i></a></li>

<li><a href="#"><i class="fa fa-google-plus"></i></a></li>

</ul> </div> </div>

(7)

</div><!--/header_top-->

<div class="header-middle"><!--header-middle-->

<div class="container"> <div class="row">

<div class="col-sm-12"> <div class="logo pull-left"> <a href="admin.php"><img src="images/home/header.jpg" alt=""

class="img-responsive" /></a>

</div>

</div>

</div> </div>

</div><!--/header-middle-->

<div class="header-bottom"><!--header-bottom-->

<div class="container"> <div class="row"> <div class="col-sm-9">

<div class="navbar-header">

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

<span class= "sr-only">Toggle navigation</span>

<span class="icon-bar"></span>

<span class="icon-bar"></span> <span class="icon-bar"></span> </button>

</div>

</div>

</div> </div>

</div><!--/header-bottom-->

</header><!--/header-->

Kode Program 4 Kode Program untuk Sidebar Menu Operator

<div class="col-sm-3">

<div class="left-sidebar">

<h2>Main Menu</h2>

<div class="list-group">

<a href="admin.php" class="list-group-item">Products

<span class="products-admin-badge pull-right text-info">0</span></a>

<a href="order.php" class="list-group-item">Orders

<span class="order-admin-badge pull-right text-danger">0</span></a>

<a href="admincategory.php" class= "list-group-item">Category <span class="category-admin-badge pull-right

text-warning">0</span></a> </div>

<div class="list-group">

<a href="logout.php" class="list-group-item active">Logout</a>

(8)

</div>

</div>

Kode Program 5 Kode Program untuk Footer Menu Pengunjung

<div class="footer-bottom"> <div class="container">

<div class="row">

<p class="pull-left">Proyek Web : Yellow Art Copyright © 2016</p>

<p class="pull-right">Yohanes Ivan Enda

562013002<span><a target="_blank" href="#"></a></span></p> </div>

</div> </div>

<script src="js/jquery.js"></script>

<script src="js/bootstrap.min.js"></script>

<script src="js/main.js"></script>

<script src="js/script.js"></script> </body>

</html>

Kode Program 6 Kode Program untuk Header Menu Pengunjung

<?php include('db.php'); ?> <?php session_start(); ?>

<?php //print_r($_SESSION['cart']); ?>

<?php date_default_timezone_set('Asia/Manila'); ?> <?php

$jim = new Data();

$countproduct = $jim->countproduct(); $cat = $jim->getcategory();

class Data {

function countproduct(){ $count = 0;

$cart = isset($_SESSION['cart']) ? $_SESSION['cart']:array();

foreach($cart as $row): if($row['qty']!=0){ $count = $count + 1; }

endforeach; return $count; }

function getcategory(){

$result = mysql_query("SELECT * FROM category"); return $result;

} } ?>

(9)

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta name="description" content="">

<meta name="author" content="">

<title>Proyek WEB : Yellow Art. Semangad CAHH</title>

<link href="css/bootstrap.min.css" rel="stylesheet">

<link href="css/font-awesome.min.css" rel="stylesheet"> <link href="css/main.css" rel="stylesheet">

<link href="css/responsive.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet">

<!--[if lt IE 9]>

<script src="js/html5shiv.js"></script> <script src="js/respond.min.js"></script> <![endif]-->

</head><!--/head-->

<body>

<header id="header"><!--header-->

<div class="header_top"><!--header_top-->

<div class="container"> <div class="row">

<div class="col-sm-6"> <div class="contactinfo"> <ul class="nav nav-pills"> <li><a href="#"><i class="fa fa-phone"></i>085727488404</a></li>

<li><a href="#"><i class="fa fa-envelope"></i>

ivanyohaness@gmail.com</a></li> </ul>

</div> </div>

<div class="col-sm-6">

<div class="social-icons pull-right"> <ul class="nav navbar-nav">

<li><a href="#"><i class="fa fa-facebook"></i></a></li> <li><a href="#"><i class="fa fa-twitter"></i></a></li> <li><a href="#"><i class="fa fa-linkedin"></i></a></li> <li><a href="#"><i class="fa fa-dribbble"></i></a></li> <li><a href="#"><i class="fa

fa-google-plus"></i></a></li> </ul>

</div> </div>

</div> </div>

</div><!--/header_top-->

<div class="header-middle"><!--header-middle-->

<div class="container"> <div class="row"> <div class="col-lg-12">

<div class="logo pull-left"> <center><a href="index.php"><img

src="images/home/header.jpg" alt="" class= "img-responsive"/></a></center>

(10)

</div> </div>

</div><!--/header-middle-->

<div class="header-bottom navbar navbar-inverse"><!--header-bottom-->

<div class="container"> <div class="row">

<div class="col-sm-9"> <div class="navbar-header navbar-default"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

<span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span>

<span class="icon-bar"></span> <span class="icon-bar"></span> </button>

</div>

<div class="mainmenu pull-left">

<ul class="nav nav collapse navbar-collapse">

<li><a href="index.php">Home</a></li>

<li class="dropdown"><a href="#">Shop<i class="fa fa-angle-down"></i></a> <ul role="menu"

class="sub-menu"> <?php $cat = $jim->getcategory();

while($row = mysql_fetch_array($cat)){ echo '<li><a

href="category.php?filter='.$row['title'].'">'.$row['title'].'</ a></li>'; }

?>

</ul>

</li> <li><a href="about.php">About Us</a></li> <li><a

href="contact.php">Contact</a></li> <li><a

href="cart.php">Cart <span class="badge"></span></a></li> <li><a href="login.php">Login</a></li>

</ul>

</div>

</div>

<div class="col-sm-3">

<div class="search_box pull-right">

<form action="index.php" method="post">

<input type="text" placeholder="Search" name="filter" />

</form>

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

</div>

</div><!--/header-bottom-->

(11)

Kode Program 7 Kode Program untuk Modal Menu Pengunjung

<!-- Modal -->

<div class="modal fade" id="checkout_modal" role="dialog">

<div class="modal-dialog modal-sm">

<div class="modal-content">

<div class="modal-header">

<button type="button" class="close"

data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>

<h4 class="modal-title" id="myModalLabel"><i class="fa fa-shopping-cart text-success fa-lg"></i> Check Out<small class='text-primary'> Billing Information</small></h4>

</div>

<div class="modal-body">

<form action="cart/data.php?q=checkout" method="POST">

<div class="form-group">

<label>Firstname</label>

<input type="text" name="fname" class= "form-control" placeholder="(ex. John)" required>

</div>

<div class="form-group">

<label>Lastname</label>

<input type="text" name="lname" class= "form-control" placeholder="(ex. Doe)" required>

</div>

<div class="form-group">

<label>Contact #</label>

<input type="text" name="contact" class= "form-control" placeholder="(ex. 0946 579 5229)" required>

</div>

<div class="form-group">

<label>Email</label>

<input type="email" name="email"

placeholder="(ex. info@yourdomain.com)" class="form-control">

</div>

<div class="form-group">

<label>Complete Address</label>

<input type="text" name="address" class= "form-control" placeholder="(ex. 2/F San Jose St., Brgy. Banga, Syudad City)" required>

</div>

<div class="alert alert-info">

Mode of Payment: <strong>Pay on Delivery</strong>

</div>

<div class="alert alert-warning">

*** Please wait for our call/text or email for confirmation. Thank You! ***

</div>

</div>

<div class="modal-footer">

<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

<button type="submit" class="btn btn-success">Submit</button>

(12)

</div>

</div>

</div> </div>

Kode Program 8 Kode Program untuk Sidebar Menu Pengunjung

<section>

<div class="container"> <div class="row">

<div class="col-sm-3">

<div class="left-sidebar"> <h2>Category</h2>

<div class="list-group">

<?php $q = "Select * from category order by title asc";

$r = mysql_query($q); if($r){

while($row = mysql_fetch_array($r)){

echo '<a

href="category.php?filter='.$row['title'].'" class="list-group-item">'.$row['title'].'</a>';

} }

?> </div>

<!--/category-products--> </div>

</div>

Kode Program 9 Kode Program untuk Koneksi Database

<?php

/* Database config */

$db_host = 'localhost'; $db_user = 'root';

$db_pass = '';

$db_database = 'dbproyek';

/* End config */

$link = mysql_connect($db_host,$db_user,$db_pass) or die('Unable to establish a DB connection');

mysql_select_db($db_database,$link); mysql_query("SET names UTF8");

?>

(13)

<?php

$mysql_hostname = "localhost"; $mysql_user = "root";

$mysql_password = "";

$mysql_database = "dbproyek"; $prefix = "";

$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");

mysql_select_db($mysql_database, $bd) or die("Could not select database");

?>

Kode Program 10 Kode Program untuk Index

<?php include('include/home/header.php'); ?>

<section>

<div class="container"> <div class="row">

<?php

include('include/home/sidebar.php'); ?> <div class="col-sm-9 padding-right">

<div class="features_items"><!--features_items-->

<h2 class="title text-center">All Products</h2>

<!--php starts here-->

<?php

//$filter = isset($_POST['filter']) ? $_POST['filter'] : '';

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

$filter = $_POST['filter'];

$result = mysql_query("SELECT * FROM products where Product like '%$filter%' or Description like '%$filter%' or Category like '%$filter%'");

} else {

$result = mysql_query("SELECT * FROM products");

}

if($result){

while($row=mysql_fetch_array($result)){ $prodID = $row["ID"];

echo '<ul class="col-sm-4">';

echo '<div class="product-image-wrapper"> <div class="single-products">

<div class="productinfo text-center">

<a href="product-details.php?prodid='.$prodID.'" rel="bookmark" title="'.$row['Product'].'"><img

src="reservation/img/products/'.$row['imgUrl'].'" alt="'.$row['Product'].'" title="'.$row['Product'].'" width="150" height="150" /></a>

(14)

title="'.$row['Product'].'">'.$row['Product'].'</a></h2> <h2>'.$row['Price'].'</h2>

<p>Category: '.$row['Category'].'</p>

<a href="product-details.php?prodid='.$prodID.'" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>View Details</a>

</div>'; echo '</ul>';

} } ?> </div>

</div> </div>

</div> </div> </section>

<?php include('include/home/footer.php'); ?>

Kode Program 11 Kode Program untuk Operator atau Penyedia Barang

<?php include('include/admin/header.php');?>

<section>

<div class="container"> <div class="row">

<?php

include('include/admin/sidebar.php');?> <div class="col-sm-9 padding-right">

<div class="features_items"><!--features_items-->

<h2 class="title text-center">All Products</h2>

<label

for="filter">Filter</label> <input type="text" name="filter"

value="" id="filter" />

<a rel="facebox" href="addproduct.php">Add Product</a> <table cellpadding="1" cellspacing="1" id="resultTable">

<thead> <tr>

<th style="border-left: 1px solid #C1DAD7"> ID </th> <th> Image </th>

<th> Product </th> <th>

Desciption </th> <th> Price

</th> <th> Category </th>

<th> Action </th> </tr>

</thead> <tbody>

<?php include('db.php');

$result = mysql_query("SELECT * FROM products"); while($row = mysql_fetch_array($result)) {

echo '<tr class="record">'; echo '<td style="border-left: 1px solid #C1DAD7;">'.$row['ID'].'</td>';

(15)

href="editproductimage.php?id='.$row['ID'].'"><img

src="reservation/img/products/'.$row['imgUrl'].'" width="80" height="50"></a></td>';

echo '<td><div

align="right">'.$row['Product'].'</div></td>'; echo '<td><div

align="right">'.$row['Description'].'</div></td>'; echo '<td><div align="right">'.$row['Price'].'</div></td>';

echo '<td><div

align="right">'.$row['Category'].'</div></td>'; echo '<td><div align="center"><a rel="facebox"

href="editproductdetails.php?id='.$row['ID'].'"><i class="fa fa-edit fa-lg text-success"></i></a> | <a href="#"

id="'.$row['ID'].'" class="delbutton" title="Click To Delete"><i class="fa fa-times-circle fa-lg

text-danger"></i></a></div></td>'; echo '</tr>'; }

?>

</tbody> </table>

</section>

<?php include('include/admin/footer.php'); ?>

Kode Program 12 Kode Program untuk Tambah Produk

<script type="text/javascript">

function validateForm()

{

var a=document.forms["addproduct"]["pname"].value;

if (a==null || a=="")

{

alert("Pls. Enter the product name");

return false;

}

var b=document.forms["addproduct"]["desc"].value;

if (b==null || b=="")

{

alert("Pls. Enter the product description");

return false;

}

var c=document.forms["addproduct"]["price"].value;

if (c==null || c=="")

{

alert("Pls. enter the price");

return false;

}

var d=document.forms["addproduct"]["cat"].value;

if (d==null || d=="")

{

alert("Pls Enter the oroduct category");

return false;

}

var e=document.forms["addproduct"]["image"].value;

if (e==null || e=="")

(16)

alert("Pls. browse an image");

return false;

} }

</script>

<style type="text/css"> </style>

<SCRIPT language=Javascript> function isNumberKey(evt)

{

var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57))

return false;

return true;

}

</SCRIPT>

<form action="addexec.php" method="post"

enctype="multipart/form-data" name="addproduct" onsubmit="return validateForm()">

Product Name<br />

<input name="pname" type="text" class="ed" /><br />

Description<br />

<input name="desc" type="text" id="rate" class="ed" /><br />

Price<br />

<input name="price" type="text" id="qty" class="ed"

onkeypress="return isNumberKey(event)" /><br />

Category<br />

<select name="cat" class="ed">

<?php

include('db.php');

$r = mysql_query("select * from category"); while($row = mysql_fetch_array($r)){

echo '<option>'.$row['title'].'</option>'; }

?>

</select>

Room Image: <br /><input type="file" name="image"

class="ed"><br />

<input type="submit" name="Submit" value="save" id="button1"

/>

</form>

Kode Program 13 Kode Program untuk Eksekusi Tambah Produk

<?php include('db.php');

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

}else{

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

(17)

if ($image_size==FALSE) {

echo "That's not an image!"; }else{

move_uploaded_file($_FILES["image"]["tmp_name"],"reserva tion/img/products/" . $_FILES["image"]["name"]);

$location=$_FILES["image"]["name"]; $pname=$_POST['pname'];

$desc=$_POST['desc']; $price=$_POST['price']; $cat=$_POST['cat'];

$update=mysql_query("INSERT INTO products (imgUrl, product, Description, Price, Category)

VALUES

('$location','$pname','$desc','$price','$cat')"); header("location: admin.php");

exit(); }

} ?>

Kode Program 14 Kode Program untuk Menu Company Profile

<?php include('include/home/header.php'); ?>

<section id="form"><!--form-->

<div class="container"> <div class="row">

<div class="4 col-sm-offset-1">

<div class= "login-form"><!--login form-->

<h2>About Us</h2> <address>

<p>Yellow Art Company</p>

<p>Bedono - Jambu Km 26 Kab. Semarang</p>

<p>Mobile : 081902847298</p> <p>Fax : (0298) 595360</p> <p>Email: </p>

</address>

</div><!--/login form-->

</div> </div>

</div>

</section><!--/form-->

<?php include('include/home/footer.php'); ?>

Kode Program 15 Kode Program untuk Kategori oleh Operator

<?php include('include/admin/header.php'); ?> <?php

(18)

$jim->addcategory($category); }

?>

<section>

<div class="container"> <div class="row">

<?php include('include/admin/sidebar.php'); ?>

<div class="col-sm-9 padding-right"> <div class="features_items"> <!--features_items-->

<h2 class="title text-center">Category</h2> <form method="POST" action="admincategory.php">

<div class="form-group">

<div class="input-group">

<div class="input-group-addon">Category Name:</div> <input name="category" class="form-control" type="text"

placeholder="..."> </div>

</div>

<div class="form-group">

<button type="submit" class="btn"

name="addcategory">Submit</button>

</div>

</form>

<hr />

<table class="table table-bordered">

<thead class="bg-primary">

<th>Name</th>

<th colspan="2">Action</th> </thead>

<tbody> <?php $category = $jim->getcategory();?>

<?php while($row = mysql_fetch_array($category)):?>

<tr> <td><?php echo $row['title'];?></td>

<td><a href="editcategory.php?p=edit&&id=<?php echo $row['id']; ?>"><i class="fa fa-edit fa-lg

text-success"></i><small>Edit</small></a></td>

<td><a

href="admincategory.php?p=delete&&table=category&&id=<?php echo $row['id']; ?>" class="confirm"><i class="fa times-circle

fa-lg text-danger"></i> <small>Remove</small></a></td>

</tr>

<?php endwhile; ?>

</tbody>

</table>

</section>

<?php include('include/admin/footer.php'); ?>

Kode Program 16 Kode Program untuk Keranjang Belanja

<?php include('include/home/header.php'); ?>

<section id="form"><!--form-->

(19)

<div class="col-sm-12">

<table class="table bordered table-responsive">

<thead class="bg-primary">

<th>Item</th>

<th>Price</th>

<th>Qty</th>

<th>Total</th>

<th></th>

</thead>

<tbody>

<?php $total = 0; ?>

<?php if(isset($_SESSION['cart'])){ ?>

<?php foreach($_SESSION['cart'] as $row): ?>

<?php if($row['qty'] != 0): ?>

<tr>

<td class="text-center"><strong><?php echo

$row['product'];?></strong></td>

<td class="text-center"><?php echo $row['price'];?></td>

<td class="text-center">

<form action="cart/data.php?q=updatecart&id=<?php echo

$row['proID'];?>" method="POST">

<input type="number" name="qty" value="<?php echo

$row['qty'];?>" min="0" style="width:50px;"/>

<button type="submit" class="btn btn-info">Update</button>

</form>

</td> <?php

$itotal = $row['price'] * $row['qty']; ?>

<td class="text-center"><font class="itotal"><?php echo $itotal; ?></font></td> <td

class="text-center"><a

href="cart/data.php?q=removefromcart&id=<?php echo

$row['proID'];?>"><i class="fa fa-times-circle fa-lg text-danger removeproduct"></i></a></td>

</tr>

<?php $total = $total + $itotal;?>

<?php endif;?>

<?php endforeach; ?>

<?php $_SESSION['totalprice'] = sset($_SESSION['totalprice']) ? $_SESSION['totalprice'] : $total; ?>

<?php $vat = $total * 0.12; ?>

<tr> <td colspan="3"

class="text-right"><strong>Sub Total</strong></td>

<td colspan="2" class="text-primary"><?php echo

number_format($total - $vat,2) ?></td>

</tr>

<tr> <td colspan="3"

class="text-right"><strong>VAT (12%)</strong></td>

<td colspan="2" class="text-danger"><?php echo

number_format($vat,2) ?></td>

</tr>

<tr> <td

colspan="3" class="text-right"><strong>TOTAL</strong></td>

<td colspan="2" class="text-danger"><strong><?php echo

number_format($total,2) ?></strong></td>

</tr> </tbody>

(20)

<div class="pull-right">

<a href="cart/data.php?q=emptycart" class="btn danger btn-lg">Empty Cart!!!</a> <a href="#"

class="btn btn-success btn-lg" data-toggle="modal" data-target="#checkout_modal">Check Out</a>

</div>

<?php }else{ ?>

<tr><td colspan="5" class="text-center alert

alert-danger"><strong>*** Your Cart is Empty ***</strong></td></tr>

</tbody>

</table>

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

</section><!--/form-->

<?php include('include/home/modal.php'); ?> <?php include('include/home/footer.php'); ?>

Kode Program 17 Kode Program untuk Kategori

<?php include('include/home/header.php'); ?>

<section>

<div class="container"> <div class="row">

<?php include('include/home/sidebar.php'); ?>

<?php $filter = isset($_GET['filter']) ? $_GET['filter'] : '';?>

<div class="col-sm-9 padding-right"> <div class="features_items"><!--features_items-->

<h2 class="title text-center">View by

<?php echo $filter;?></h2>

<br>

<!--php starts here-->

<?php

$result = mysql_query("SELECT * FROM products where Product like '%$filter%' or Description like '%$filter%' or Category like '%$filter%'");

if($result){

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

$prodID = $row["ID"]; echo '<ul class="col-sm-4">'; echo '<div class="product-image-wrapper">

<div class="single-products"> <div class="productinfo text-center"> <a href="product-details.php?prodid='.$prodID.'" rel="bookmark"

title="'.$row['Product'].'"><img

src="reservation/img/products/'.$row['imgUrl'].'" alt="'.$row['Product'].'" title="'.$row['Product'].'" width="150" height="150" />

</a>

(21)

href="product-details.php?prodid='.$prodID.'" rel="bookmark"

title="'.$row['Product'].'">'.$row['Product'].'</a></h2> <h2>'.$row['Price'].'</h2>

<p>Category: '.$row['Category'].'</p>

<a

href="product-details.php?prodid='.$prodID.'" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>View Details</a>

</div>';

echo '</ul>'; }

} ?> </div>

</div> </div>

</div> </div> </section>

<?php include('include/home/footer.php'); ?>

Kode Program 18 Kode Program untuk Kontak Perusahaan

<?php include('include/home/header.php'); ?>

<div id="contact-page" class="container">

<div class="bg">

<div class="row">

<div class="col-sm-12"> <h2 class="title text-center">Contact <strong>Us</strong></h2>

</div>

</div> <div class="row">

<div class="col-sm-8">

<div class="contact-form">

<h2 class="title text-center">Get In Touch</h2>

<div class="status alert alert-success" style="display: none"></div>

<form id= "main-contact-form" class="contact-form row" name="contact-form"

method="post"> <div class="form-group col-md-6">

<input type="text" name="name" class="form-control"

required placeholder="Name">

</div>

<div class="form-group col-md-6">

<input type="email" name="email" class= "form-control" required placeholder="Email">

</div>

<div class="form-group col-md-12">

<input type="text" name="subject" class= "form-control" required placeholder="Subject">

</div>

<div class="form-group col-md-12">

(22)

class="form-control" rows="8" placeholder="Your Message Here"></textarea>

</div> <div class="form-group col-md-12">

<input type="submit" name="submit" class="btn btn-primary pull-right" value="Submit">

</div>

</form>

</div>

</div>

<div class="col-sm-4">

<div class="contact-info"> <h2 class="title text-center">Contact Info</h2>

<address> <p>Yohanes Ivan Enda</p>

<p>Mobile : 085727488404</p> <p>Fax : (0298) 595360</p>

<p>Email : ivanyohanes@gmail.com</p> </address>

<div class="social-networks">

<h2 class="title text-center">Social Networking</h2>

<p>Fb : Yohanes Ivan Enda</p>

<p>Twittre : @yohanesivanenda</p><p>Youtube : Yohanes Ivan Enda</p> <p>Gmail :

ivanyohanes@gmail.com</p> <ul>

<li>

<a href="#"><i class="fa fa-facebook"></i></a>

</li>

<li> <a

href="#"><i class="fa fa-twitter"></i></a> </li>

<li>

<a href="#"><i class="fa fa-google-plus"></i></a> </li>

<li>

<a href="#"><i class="fa fa-youtube"></i></a>

</li>

</ul>

</div>

</div>

</div> </div>

</div>

</div><!--/#contact-page-->

<?php include('include/home/footer.php'); ?>

Kode Program 19 Kode Program untuk Delete Produk

<?php

(23)

$id=$_GET['id'];

$sql = "delete from products where id='$id'"; mysql_query( $sql);

}

?>

Kode Program 20 Kode Program untuk Edit Category

<?php include('include/admin/header.php'); ?> <?php

$categoryvalue = '';

$categoryID = isset($_GET['id']) ? $_GET['id'] : null; if(isset($_POST['editcategory'])){

$category = $_POST['category']; $id = $_GET['id'];

$jim->updatecategory($category,$id); }

if(isset($_GET['id'])){ $id = $_GET['id'];

$categoryvalue = $jim->getcategorybyid($id); }

?>

<section>

<div class="container"> <div class="row">

<?php include('include/admin/sidebar.php'); ?>

<div class="col-sm-9 padding-right"> <div

class="features_items"><!--features_items-->

<h2 class="title text-center">Category</h2>

<form method="POST"

action="editcategory.php?id=<?php echo $categoryID;?>">

<div class="form-group">

<div class="input-group">

<div class="input-group-addon">Category Name:</div>

<input name="category" value="<?php echo $categoryvalue; ?>" class="form-control" type="text"

placeholder="..."> </div>

</div>

<div class="form-group">

<button type="submit"

class="btn" name="editcategory">Update</button>

<a href="admincategory.php" class="btn btn-success">Add Category</a>

</div>

</form>

<hr />

<table class="table table-bordered">

<thead class="bg-primary">

<th>Name</th>

<th colspan="2">Action</th>

</thead>

(24)

<?php while($row = mysql_fetch_array($category)):?>

<tr>

<td><?php echo $row['title'];?></td>

td><a href="editcategory.php?p=edit&&id=<?php echo $row['id']; ?>"><i class="fa fa-edit fa-lg text-success"></i><small>Edit</small></a></td>

<td><a

href="admincategory.php?p=delete&&table=category&&id=<?php echo $row['id']; ?>" class="confirm"><i class="fa times-circle fa-lg text-danger"></i> <small>Remove</small></a></td>

</tr>

<?php endwhile; ?>

</tbody>

</table>

</section>

<?php include('include/admin/footer.php'); ?>

Kode Program 21 Kode Program Edit Gambar

<?php

include('db.php');

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

}else{

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

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

if ($image_size==FALSE) {

echo "That's not an image!"; }else{

move_uploaded_file($_FILES["image"]["tmp_name"],"reserva tion/img/products/" . $_FILES["image"]["name"]);

$location=$_FILES["image"]["name"]; $prodid=$_POST['prodid'];

if(!$update=mysql_query("UPDATE products SET imgUrl = '$location' WHERE ID='$prodid'")) {

echo mysql_error(); }

else{

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

} } }

?>

Kode Program 22 Kode Program untuk Detail Produk

<style type="text/css"> </style>

<?php

(25)

$id=$_GET['id'];

$result = mysql_query("SELECT * FROM products where ID='$id'");

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

$pname=$row['Product']; $desc=$row['Description']; $price=$row['Price']; $cat=$row['Category']; }

?>

<form action="execeditproduct.php" method="post">

<input type="hidden" name="prodid" value="<?php echo $id=$_GET['id'] ?>">

Product Name:<br><input type="text" name="pname"

value="<?php echo $pname ?>" class="ed"><br>

Description:<br><input type="text" name="desc"

value="<?php echo $desc ?>" class="ed"><br>

Price:<br><input type="text" name="price" value="<?php echo $price ?>" class="ed"><br>

Category:<br>

<select name="cat" class="ed">

<?php

include('db.php');

$r = mysql_query("select * from category"); while($row = mysql_fetch_array($r)){

$selected = ($cat == $row['title']) ? " selected='selected'" : "";

echo '<option

'.$selected.'>'.$row['title'].'</option>'; }

?>

</select>

<br>

<input type="submit" value="Update" id="button1"> </form>

Kode Program 23 Kode Program untuk Gambar Produk

<?php

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

$result = mysql_query("SELECT * FROM products where ID='$id'");

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

$image=$row['imgUrl']; }

?>

<img src="reservation/img/products/<?php echo $image ?>"> <form action="editpicexec.php" method="post"

enctype="multipart/form-data"> <br>

(26)

Select Image

<br>

<input type="file" name="image"><br> <input type="submit" value="Upload"> </form>

Kode Program 24 Kode Program untuk Login dan Logout

<?php include('include/home/header.php'); ?>

<section id="form"><!--form-->

<div class="container"> <div class="row">

<div class="col-sm-4 col-sm-offset-1" <div class="login-form"><!--login form-->

<div class="error"></div> <h2>Administrative Login</h2>

<form>

<input type="text" name="username"

placeholder="username" id="username" required/>

<input type="password" name="password" placeholder="password"

id="password" required/> <button type="button" name="submit" class="btn btn-default"

id="login">Login</button> </form> </div><!--/login form-->

</div> </div>

</div>

</section><!--/form-->

<?php include('include/home/footer.php'); ?>

Pada File berbeda Untuk Logout :

<?php

session_start(); session_destroy();

header('location:login.php'); ?>

Kode Program 25 Kode Program untuk Item Produk

<?php include('include/admin/header.php'); ?> <section>

<div class="container"> <div class="row">

<?php include('include/admin/sidebar.php'); ?>

<div class="col-sm-9 padding-right">

<div class="features_items"><!--features_items--> <?php $item = $jim->getorder(); ?>

<?php while($row = mysql_fetch_array($item)): ?>

(27)

<div class="panel panel-default">

<div class="panel-heading"> <h3

class="panel-title">ORDER INFORMATION</h3> </div>

<div class="panel-body">

<table class="table">

<tr>

<td class="text-right"><strong>Customer :</strong></td> <td class="text-info"><strong><?php echo

$row['name'];?></strong></td>

</tr>

<tr>

<td class="text-right"><strong>Contact :</strong></td>

<td class="text-info"><strong><?php echo $row['contact'];?></strong></td>

</tr>

<tr>

<td class="text-right"><strong>Address :</strong></td>

<td class="text-info"><strong><?php echo $row['address'];?></strong></td>

</tr> <tr>

<td class="text-right"><strong>Email :</strong></td>

<td class="text-info"><strong><?php echo $row['email'];?></strong></td>

</tr>

<tr>

<td class="text-right"><strong>Date Ordered :</strong></td>

<td class="text-info"><strong><?php echo $row['dateOrdered'];?></strong></td>

</tr>

<tr>

<td class="text-right"><strong>Amount :</strong></td>

<td class="text-danger"><strong><?php echo $row['amount'];?></strong></td>

</tr>

<tr>

<td class="text-right"><strong>Item(s) :</strong></td>

<td class="text-primary"><strong><?php echo $row['item'];?></strong></td>

</tr>

<tr>

<?php if($p == 'unconfirmed'){ ?>

<td class="text-right" colspan="2"><a

href="order.php?p=deliver&&id=<?php echo $row['id']; ?>"

class="btn btn-warning">Deliver</a></td>

<?php }else if($p == 'delivered'){?>

<td class="text-right" colspan="2"><a

href="order.php?p=paid&&id=<?php echo $row['id']; ?>" class="btn btn-warning">Paid</a></td>

<?php } ?> </tr>

</table>

</div>

</div> <?php endwhile; ?>

(28)

<?php include('include/admin/footer.php'); ?>

Kode Program 26 Kode Program untuk Eksekusi Edit Produk

<?php

include('db.php');

$prodid = $_POST['prodid']; $pname=$_POST['pname']; $desc=$_POST['desc']; $price=$_POST['price']; $cat=$_POST['cat'];

mysql_query("UPDATE products SET Product='$pname', Description='$desc', Price='$price', Category='$cat' WHERE ID='$prodid'");

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

Kode Program 27 Kode Program untuk Pemesanan Produk

<?php include('include/admin/header.php'); ?> <section>

<div class="container"> <div class="row">

<?php include('include/admin/sidebar.php'); ?>

<div class="col-sm-9 padding-right"> <div class="features_items"><!--features_items-->

<h2 class="title text-center">Orders</h2> <!-- Nav tabs -->

<ul class="nav nav-tabs" role="tablist">

<li class="active"><a href="#data1" role="tab" data-toggle="tab">Unpaid Orders</a></li>

<li><a href="#data2" role="tab" data-toggle="tab">Delivered Orders</a></li>

<li><a href="#data3" role="tab" data-toggle="tab">Paid Orders</a></li>

</ul>

<!-- Tab panes -->

<div class="tab-content">

<div class="tab-pane active" id="data1">

<table class="table table-bordered">

<thead class="bg-primary">

<th>Date Ordered</th>

<th>Customer</th>

<th>Item</th>

<th>Action</th>

</thead>

<?php $unpaid = $jim->getunpaidorders(); ?>

<?php while($row = mysql_fetch_array($unpaid)){ ?>

<tr>

<td class="text-center"><?php echo $row['dateOrdered']; ?></td>

<td><?php echo $row['name']; ?></td>

<td class="text-center"><a

href="item.php?id=<?php echo $row['id']?>&&p=unconfirmed"

Referensi

Dokumen terkait

Mutual Fund Performance Evaluation Using Data Envelopment Analysis with New Risk Measures. Data Envelopment Analysis: A Comprehensive Text with Models, Applications, References,

terhadap anak melalui media televisi serta mengenai sanksi yang dikenakan. kepada media televisi yang melakukan pemberitaan korban

Dalam penelitian yang dilakukan dengan metode iterasi Gauss Newton ini masih terdapat kelemahan yaitu nilai jumlah kuadrat galatnya masih sangat besar,

Dari hasil analisis yang telah dilakukan, dapat diketahui bahwa faktor konteks dan kapabilitas masing – masing memiliki kontribusi yang mempengaruhi manfaat

Recent study by Humphrey et al (2007) found out that successful work design innovation has positive impact on employee’s behavior and attitudes such as performance,

[r]

Dalam praktiknya, framing dijalankan oleh media dengan menseleksi isu – isu tertentu dan mengabaikan isu yang lain; dan menonjolkan aspek dari isu tersebut

Mata bor helix kecil ( Low helix drills ) : mata bor dengan sudut helix lebih kecil dari ukuran normal berguna untuk mencegah pahat bor terangkat ke atas