Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pengumpulan tugas Besar 1 #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions README.md

This file was deleted.

184 changes: 184 additions & 0 deletions ruserba.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
-- phpMyAdmin SQL Dump
-- version 3.4.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 29, 2013 at 03:15 PM
-- Server version: 5.5.16
-- PHP Version: 5.3.8

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `ruserba`
--

-- --------------------------------------------------------

--
-- Table structure for table `barang`
--

CREATE TABLE IF NOT EXISTS `barang` (
`id_barang` int(11) NOT NULL AUTO_INCREMENT,
`nama_barang` varchar(256) NOT NULL,
`id_kategori` int(11) NOT NULL,
`harga_barang` bigint(20) NOT NULL,
`gambar` varchar(256) NOT NULL,
`tersedia` int(11) NOT NULL,
`dibeli` int(11) NOT NULL,
PRIMARY KEY (`id_barang`),
KEY `id_kategori` (`id_kategori`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=27 ;

--
-- Dumping data for table `barang`
--

INSERT INTO `barang` (`id_barang`, `nama_barang`, `id_kategori`, `harga_barang`, `gambar`, `tersedia`, `dibeli`) VALUES
(1, 'Giordano', 1, 300000, 'giordano.jpg', 10, 1),
(2, 'Polo', 1, 150000, 'polo.jpg', 10, 1),
(3, 'Dagadu', 1, 50000, 'dagadu.jpg', 30, 10),
(4, 'Joger', 1, 40000, 'joger.jpg', 5, 1),
(5, 'Samsung', 2, 1500000, 'samsung.jpg', 13, 10),
(6, 'Iphone', 2, 5000000, 'iphone.jpg', 5, 0),
(7, 'Nokia', 2, 2000000, 'nokia.jpg', 6, 3),
(8, 'Mito', 2, 200000, 'mito.jpg', 7, 3),
(9, 'Cubitus', 3, 150000, 'cubitus.jpg', 6, 3),
(10, 'Levis', 3, 400000, 'levis.jpg', 5, 1),
(11, 'Lee', 3, 300000, 'lee.jpg', 4, 2),
(12, 'Ayam Bawang', 4, 2000, 'ayambawang.png', 50, 10),
(13, 'Rendang', 4, 2500, 'rendang.png', 10, 50),
(14, 'Kari Ayam', 4, 2000, 'kariayam.jpg', 40, 15),
(15, 'Cabe Ijo', 4, 2000, 'cabeijo.jpg', 40, 20),
(16, 'Soto', 4, 2000, 'soto.jpg', 25, 10),
(17, 'Aqua', 5, 3000, 'aqua.jpg', 10, 20),
(18, 'Mizone', 5, 5000, 'mizone.jpg', 20, 1),
(19, 'Kiranti', 5, 6000, 'kiranti.jpg', 1, 1),
(20, 'Mix Max', 5, 20000, 'mixmax.jpg', 1, 60),
(21, 'Vit', 5, 1000, 'vit.jpg', 10, 0);

-- --------------------------------------------------------

--
-- Table structure for table `kartu_kredit`
--

CREATE TABLE IF NOT EXISTS `kartu_kredit` (
`username` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`no_kartu` varchar(16) NOT NULL,
`nama` varchar(256) NOT NULL,
`kadaluarsa` date NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `kartu_kredit`
--

INSERT INTO `kartu_kredit` (`username`, `no_kartu`, `nama`, `kadaluarsa`) VALUES
('admin', '1732979879817329', 'admin ga ganteng', '2013-10-31');

-- --------------------------------------------------------

--
-- Table structure for table `kategori`
--

CREATE TABLE IF NOT EXISTS `kategori` (
`id_kategori` int(11) NOT NULL AUTO_INCREMENT,
`nama_kategori` varchar(256) NOT NULL,
PRIMARY KEY (`id_kategori`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;

--
-- Dumping data for table `kategori`
--

INSERT INTO `kategori` (`id_kategori`, `nama_kategori`) VALUES
(1, 'Baju'),
(2, 'Gadget'),
(3, 'Celana'),
(4, 'Indomie'),
(5, 'Minuman');

-- --------------------------------------------------------

--
-- Table structure for table `user`
--

CREATE TABLE IF NOT EXISTS `user` (
`username` varchar(20) COLLATE utf8_bin NOT NULL,
`password` varchar(256) COLLATE utf8_bin NOT NULL,
`token` varchar(20) COLLATE utf8_bin DEFAULT NULL,
`last_login` date DEFAULT NULL,
PRIMARY KEY (`username`),
UNIQUE KEY `token` (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`username`, `password`, `token`, `last_login`) VALUES
('admin', 'asdfasdf', '9kWVGnZp6rxlYeUbrYYT', '2013-10-29');

-- --------------------------------------------------------

--
-- Table structure for table `user_profile`
--

CREATE TABLE IF NOT EXISTS `user_profile` (
`username` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`nama` varchar(256) NOT NULL,
`email` varchar(100) NOT NULL,
`alamat` varchar(256) DEFAULT NULL,
`kota` varchar(256) DEFAULT NULL,
`kode_pos` varchar(5) DEFAULT NULL,
`provinsi` varchar(256) DEFAULT NULL,
`nomor_ponsel` varchar(15) DEFAULT NULL,
PRIMARY KEY (`username`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `user_profile`
--

INSERT INTO `user_profile` (`username`, `nama`, `email`, `alamat`, `kota`, `kode_pos`, `provinsi`, `nomor_ponsel`) VALUES
('admin', 'admin ganteng', '[email protected]', 'alamat admin', 'kota admin', '13452', 'prov admin', '0987654321');

--
-- Constraints for dumped tables
--

--
-- Constraints for table `barang`
--
ALTER TABLE `barang`
ADD CONSTRAINT `barang_ibfk_1` FOREIGN KEY (`id_kategori`) REFERENCES `kategori` (`id_kategori`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `kartu_kredit`
--
ALTER TABLE `kartu_kredit`
ADD CONSTRAINT `kartu_kredit_ibfk_1` FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `user_profile`
--
ALTER TABLE `user_profile`
ADD CONSTRAINT `user_profile_ibfk_1` FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
32 changes: 32 additions & 0 deletions ruserba/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Options +FollowSymLinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^search/([^\/\\]+)/?$ index.php?page=search&q=$1 [NC,L]
RewriteRule ^search/([^\/\\]+)/([0-9]+)/?$ index.php?page=search&q=$1&p=$2 [NC,L]
RewriteRule ^search/?$ index.php?page=error [NC,L]

RewriteRule ^kategori/([0-9]+)/?$ index.php?page=kategori&id=$1 [NC,L]
RewriteRule ^kategori/([0-9]+)/name/?$ index.php?page=kategori&id=$1&orderby=name [NC,L]
RewriteRule ^kategori/([0-9]+)/name/asc/?$ index.php?page=kategori&id=$1&orderby=name&sort=asc [NC,L]
RewriteRule ^kategori/([0-9]+)/name/desc/?$ index.php?page=kategori&id=$1&orderby=name&sort=desc [NC,L]
RewriteRule ^kategori/([0-9]+)/price/?$ index.php?page=kategori&id=$1&orderby=price [NC,L]
RewriteRule ^kategori/([0-9]+)/price/asc/?$ index.php?page=kategori&id=$1&orderby=price&sort=asc [NC,L]
RewriteRule ^kategori/([0-9]+)/price/desc/?$ index.php?page=kategori&id=$1&orderby=price&sort=desc [NC,L]
RewriteRule ^kategori/([0-9]+)/([0-9]+)/name/?$ index.php?page=kategori&id=$1&p=$2&orderby=name [NC,L]
RewriteRule ^kategori/([0-9]+)/([0-9]+)/name/asc/?$ index.php?page=kategori&id=$1&p=$2&orderby=name&sort=asc [NC,L]
RewriteRule ^kategori/([0-9]+)/([0-9]+)/name/desc/?$ index.php?page=kategori&id=$1&p=$2&orderby=name&sort=desc [NC,L]
RewriteRule ^kategori/([0-9]+)/([0-9]+)/price/?$ index.php?page=kategori&id=$1&p=$2&orderby=price [NC,L]
RewriteRule ^kategori/([0-9]+)/([0-9]+)/price/asc/?$ index.php?page=kategori&id=$1&p=$2&orderby=price&sort=asc [NC,L]
RewriteRule ^kategori/([0-9]+)/([0-9]+)/price/desc/?$ index.php?page=kategori&id=$1&p=$2&orderby=price&sort=desc [NC,L]
RewriteRule ^kategori/([0-9]+)/([0-9]+)/?$ index.php?page=kategori&id=$1&p=$2 [NC,L]
RewriteRule ^kategori/?$ index.php?page=error [NC,L]

RewriteRule ^barang/([0-9]+)/?$ index.php?page=barang&id=$1 [NC,L]
RewriteRule ^barang/?$ index.php?page=error [NC,L]

RewriteRule ^([a-z0-9]+)/?$ index.php?page=$1 [NC,L]

ErrorDocument 404 /ruserba/index.php?page=error
Binary file added ruserba/assets/barang/Levis.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/aqua.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/ayambawang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/cabeijo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/cubitus.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/dagadu.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/giordano.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/iphone.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/joger.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/kariayam.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/kiranti.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/lee.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/mito.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/mixmax.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/mizone.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/nokia.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/polo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/rendang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/samsung.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/soto.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/barang/vit.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/cart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/favicon.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/icon_recommend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/icon_star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ruserba/assets/logo.png
Binary file added ruserba/assets/search.png
22 changes: 22 additions & 0 deletions ruserba/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE HTML>
<?php session_start(); ?>
<html>
<head>
<?php include 'scripts/php/page.php'; ?>
<title><?php echo getPageTitle(); ?></title>
<link rel='icon' type='image/png' href='/ruserba/assets/favicon.png' />
<link rel='stylesheet' media='only screen and (min-width:1224px)' href='/ruserba/stylesheets/desktop.css' />
</head>
<body>
<div id='wrapper'>
<div id='header'><?php include 'pages/header.php'; ?></div>
<div class='divider'></div>
<div id='content'>
<?php include getPageContent(); ?>
</div>
<div class='divider'></div>
<div id='footer'><?php include 'pages/footer.php'; ?></div>
<br /><br /><br /><br /><br /><br />
</div>
</body>
</html>
55 changes: 55 additions & 0 deletions ruserba/pages/barang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<script>var cartcontent = JSON.parse('<?php echo isset($_SESSION["cart"]) ? json_encode($_SESSION["cart"]) : "{}"; ?>');</script>
<script src='/ruserba/scripts/addamounttocart.js'></script>
<?php
$query = 'select * from barang where id_barang=?';
$params = array($_GET['id']);
include 'scripts/php/query.php';
$barang = $result[0];
echo '<h3 class="judul_halaman">';
echo $barang['nama_barang'];
echo '</h3>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<div class="barang_container">';
echo '<div class="barang_gambar_detail">';
echo '<img src="/ruserba/assets/barang/'.$barang['gambar'].'" width=100%/>';
echo '</div>';
echo '<div class="barang_detail">';
$query = 'select nama_kategori from kategori where id_kategori=?';
$params = array($barang['id_kategori']);
include 'scripts/php/query.php';
echo 'Kategori: ';
echo '<a href="/ruserba/kategori/'.$barang['id_kategori'].'">';
echo $result[0]['nama_kategori'];
echo '</a>';
echo '<span class="barang_nama">';
echo '</span>';
echo '<br>';
if($barang['tersedia']==0){
echo '<span class="barang_tersedia">';
echo 'Barang tidak tersedia';
echo '</span>';
echo '<br>';
}
else{
echo '<span class="barang_tersedia">';
echo 'Barang tersedia ('.$barang['tersedia'].' unit)';
echo '</span>';
echo '<br>';
}
echo '<span class="barang_harga">';
echo 'Rp '.$barang['harga_barang'].',00';
echo '</span>';
echo '<br>';
echo '<br>';
echo '<br>';
if ($barang['tersedia'] > 0) {
echo 'Jumlah ';
echo '<input type="number" class="inputjumlah" name="jumlah" value="1" min="1" max="'.(isset($_SESSION['cart'][$barang['id_barang']]) ? ($barang['tersedia'] - $_SESSION['cart'][$barang['id_barang']]) : $barang['tersedia']).'"/>';
echo '<br>';
echo '<a class="button beli" name="'.$barang['id_barang'].'" href="javascript:void(0)"><div>Pesan Barang</div></a>';
}
echo '</div>';
echo '</div>';
?>
Loading