diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..dde2cd4 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,4 @@ +1. Buat database dengan nama "datauser" di server +2. Import .sql ke dalam database "datauser" +3. Copykan folder src ke folder public di server, seharusnya /xampp/tomcat/webapps/ jika menggunakan xampp +4. Akses folder tersebut lewat URL, pada umumnya dengan format sebagai berikut localhost:8080/src diff --git a/MEMBER.md b/MEMBER.md new file mode 100644 index 0000000..1c2bd96 --- /dev/null +++ b/MEMBER.md @@ -0,0 +1,3 @@ +1. 13511012 Dyah Rahmawati 13511012@stei.itb.ac.id DyahRahma +2. 13511052 Ananda Kurniawan Pramudiono 13511052@stei.itb.ac.id AnandaKurniawan +3. 13511086 Willy Fitra Hendria willyfitrahendria@gmail.com willyfh diff --git a/db/database.sql b/db/database.sql new file mode 100644 index 0000000..d882971 --- /dev/null +++ b/db/database.sql @@ -0,0 +1,263 @@ +-- phpMyAdmin SQL Dump +-- version 3.5.2.2 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Generation Time: Nov 27, 2013 at 03:29 PM +-- Server version: 5.5.27 +-- PHP Version: 5.4.7 + +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: `datauser` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `barang` +-- + +CREATE TABLE IF NOT EXISTS `barang` ( + `IdBarang` int(11) DEFAULT NULL, + `NamaBarang` varchar(20) DEFAULT NULL, + `Harga` int(11) DEFAULT NULL, + `Kategori` varchar(20) DEFAULT NULL, + `Jumlah` int(11) DEFAULT NULL, + `Deskripsi` varchar(100) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `barang` +-- + +INSERT INTO `barang` (`IdBarang`, `NamaBarang`, `Harga`, `Kategori`, `Jumlah`, `Deskripsi`) VALUES +(1, 'DagingSapi', 80000, 'Daging', 4, NULL), +(2, 'IceCream', 10000, 'Snack', 8, NULL), +(3, 'ChickenNugget', 30000, 'Frozen Food', 8, NULL), +(4, 'BayamItali', 5000, 'Sayuran', 1, 'null'), +(5, 'BerasCarrefour', 11000, 'Beras', 0, 'ini beras carrefour'), +(6, 'DagingYak', 85000, 'Daging', 1, NULL), +(7, 'BerasTajMahal', 25000, 'Beras', 5, 'ini beras tajmahal'), +(8, 'BerasHCSR04', 22000, 'Beras', 1, NULL), +(9, 'BerasRaskin', 7000, 'Beras', 5, 'ini beras raskin'), +(10, 'DagingAyam', 122000, 'Daging', 1, NULL), +(11, 'DagingDomba', 92000, 'Daging', 5, NULL), +(12, 'PetaiCHINA', 2500, 'Sayuran', 1, NULL), +(13, 'SeledriHongkong', 4500, 'Sayuran', 12, NULL), +(14, 'TimunAustralia', 14500, 'Sayuran', 5, NULL), +(15, 'SOZZZZZZIS', 32000, 'Frozen Food', 24, NULL), +(16, 'FIESTANIGGA', 22000, 'Frozen Food', 9, NULL), +(17, 'BAKSOSOGOOD', 28000, 'Frozen Food', 40, NULL), +(18, 'BerasA-KING', 3000, 'Beras', 19, 'null'), +(19, 'DagingBebek', 15000, 'Daging', 8, NULL), +(20, 'SiomayMantap', 20500, 'Frozen Food', 10, NULL), +(21, 'Kangkung', 5300, 'Sayuran', 9, NULL), +(22, 'ToKaeNoi', 5400, 'Snack', 7, NULL), +(23, 'LeoKripikKentang', 3100, 'Snack', 8, NULL), +(24, 'MiGemez', 1200, 'Snack', 19, NULL), +(25, 'Bengbeng', 2050, 'Snack', 9, NULL); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `creditcard` +-- + +CREATE TABLE IF NOT EXISTS `creditcard` ( + `number` varchar(50) DEFAULT NULL, + `name` varchar(50) DEFAULT NULL, + `expiredate` varchar(50) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `creditcard` +-- + +INSERT INTO `creditcard` (`number`, `name`, `expiredate`) VALUES +('12341234', 'budi lagi', '2014-04-07'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `transactionlog` +-- + +CREATE TABLE IF NOT EXISTS `transactionlog` ( + `NamaBarang` varchar(20) DEFAULT NULL, + `Harga` int(11) DEFAULT NULL, + `Jumlah` int(11) DEFAULT NULL, + `Username` varchar(20) DEFAULT NULL, + `Kategori` varchar(20) DEFAULT NULL, + `DetailPesanan` varchar(100) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `transactionlog` +-- + +INSERT INTO `transactionlog` (`NamaBarang`, `Harga`, `Jumlah`, `Username`, `Kategori`, `DetailPesanan`) VALUES +('DagingSapi', 80000, 3, 'budie', 'Daging', NULL), +('DagingSapi', 80000, 2, 'budie', 'Daging', NULL), +('IceCream', 10000, 3, 'budie', 'Snack', NULL), +('IceCream', 10000, 4, 'budie', 'Snack', NULL), +('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', NULL), +('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', NULL), +('BayamItali', 5000, 7, 'budie', 'Sayuran', NULL), +('BerasCarrefour', 12000, 2, 'budie', 'Beras', NULL), +('DagingYak', 85000, 7, 'budie', 'Daging', NULL), +('DagingYak', 85000, 5, 'budie', 'Daging', NULL), +('DagingYak', 85000, 5, 'budie', 'Daging', NULL), +('BerasCarrefour', 12000, 3, 'budie', 'Beras', NULL), +('BerasTajMahal', 25000, 5, 'budie', 'Beras', NULL), +('DagingSapi', 80000, 2, 'budie', 'Daging', NULL), +('DagingAyam', 122000, 3, 'budie', 'Daging', NULL), +('BayamItali', 5000, 2, 'budie', 'Sayuran', NULL), +('PetaiCHINA', 2500, 3, 'budie', 'Sayuran', NULL), +('ChickenNugget', 30000, 2, 'budie', 'Frozen Food', NULL), +('BerasCarrefour', 12000, 1, 'Boci', 'Beras', NULL), +('IceCream', 10000, 2, 'budie', 'Snack', NULL), +('BerasCarrefour', 12000, 2, 'budie', 'Beras', NULL), +('ChickenNugget', 30000, 2, 'budie', 'Frozen Food', NULL), +('BayamItali', 5000, 2, 'yuhustore', 'Sayuran', NULL), +('DagingSapi', 80000, 1, 'budie', 'Daging', NULL), +('BayamItali', 5000, 1, 'budie', 'Sayuran', NULL), +('BerasCarrefour', 12000, 1, 'budie', 'Beras', NULL), +('BerasA-KING', 200, 3, 'budie', 'Beras', NULL), +('BayamItali', 5000, 4, 'budie', 'Sayuran', NULL), +('IceCream', 10000, 1, 'budie', 'Snack', NULL), +('DagingSapi', 80000, 1, 'budie', 'Daging', NULL), +('DagingSapi', 80000, 20, 'budie', 'Daging', NULL), +('DagingYak', 85000, 1, 'aditya2', 'Daging', NULL), +('DagingSapi', 80000, 1, 'aditya2', 'Daging', NULL), +('BayamItali', 5000, 1, 'budie', 'Sayuran', NULL), +('BerasHCSR04', 22000, 1, 'Budie', 'Beras', NULL), +('BerasRaskin', 20000, 1, 'Budie', 'Beras', NULL), +('Kangkung', 5300, 1, 'Budie', 'Sayuran', NULL), +('Kangkung', 5300, 1, 'Budie', 'Sayuran', NULL), +('TimunAustralia', 14500, 1, 'Budie', 'Sayuran', NULL), +('LeoKripikKentang', 3100, 1, 'Budie', 'Snack', NULL), +('IceCream', 10000, 1, 'Budie', 'Snack', NULL), +('Bengbeng', 2050, 2, 'Budie', 'Snack', NULL), +('SiomayMantap', 20500, 1, 'Budie', 'Frozen Food', NULL), +('BAKSOSOGOOD', 28000, 1, 'Budie', 'Frozen Food', NULL), +('DagingHiu', 50000, 1, 'bebek', 'Daging', ''), +('DagingDomba', 92000, 1, 'bebek', 'Daging', ''), +('LeoKripikKentang', 3100, 1, 'bebek', 'Snack', ''), +('BerasHCSR04', 22000, 1, 'bebek', 'Beras', ''), +('BerasCarrefour', 11000, 20, 'bebek', 'Beras', ''), +('BerasCarrefour', 11000, 23, 'bebek', 'Beras', ''), +('BerasCarrefour', 11000, 1, 'bebek', 'Beras', ''), +('BerasCarrefour', 11000, 20, 'bebek', 'Beras', ''), +('BerasCarrefour', 11000, 30, 'bebek', 'Beras', ''), +('BerasTajMahal', 25000, 50, 'bebek', 'Beras', ''), +('BerasRaskin', 7000, 10, 'bebek', 'Beras', ''), +('BerasHCSR04', 22000, 10, 'bebek', 'Beras', ''), +('BerasHCSR04', 22000, 50, 'bebek', 'Beras', ''), +('BerasHCSR04', 22000, 50, 'bebek', 'Beras', ''), +('BerasHCSR04', 22000, 5, 'bebek', 'Beras', ''), +('BerasCarrefour', 11000, 4, 'bebek', 'Beras', ''), +('IceCream', 10000, 4, 'budie', 'Snack', ''), +('DagingSapi', 80000, 4, 'budie', 'Daging', ''), +('DagingDomba', 92000, 2, 'budie', 'Daging', ''), +('DagingYak', 85000, 1, 'budie', 'Daging', ''), +('DagingYak', 85000, 5, 'budie', 'Daging', ''), +('DagingSapi', 80000, 1, 'budie', 'Daging', ''), +('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', ''), +('SOZZZZZZIS', 32000, 1, 'budie', 'Frozen Food', ''), +('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', ''), +('BAKSOSOGOOD', 28000, 2, 'budie', 'Frozen Food', ''), +('FIESTANIGGA', 22000, 6, 'budie', 'Frozen Food', ''), +('BayamItali', 5000, 1, 'budie', 'Sayuran', ''), +('PetaiCHINA', 2500, 1, 'budie', 'Sayuran', ''), +('DagingBebek', 15000, 1, 'budie', 'Daging', ''), +('ToKaeNoi', 5400, 1, 'budie', 'Snack', ''), +('IceCream', 10000, 1, 'budie', 'Snack', ''), +('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', ''), +('DagingSapi', 80000, 1, 'budie', 'Daging', ''), +('DagingYak', 85000, 3, 'budie', 'Daging', ''), +('DagingAyam', 122000, 1, 'budie', 'Daging', ''), +('DagingBebek', 15000, 1, 'budie', 'Daging', ''), +('BayamItali', 5000, 1, 'budie', 'Sayuran', ''), +('PetaiCHINA', 2500, 3, 'budie', 'Sayuran', ''), +('IceCream', 10000, 1, 'budie', 'Snack', ''), +('DagingYak', 85000, 1, 'budie', 'Daging', ''), +('ToKaeNoi', 5400, 1, 'budie', 'Snack', ''), +('BerasCarrefour', 11000, 1, 'budie', 'Beras', ''), +('BerasHCSR04', 22000, 1, 'budie', 'Beras', ''), +('BerasCarrefour', 11000, 5, 'budie', 'Beras', ''), +('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', ''), +('MiGemez', 1200, 4, 'budie', 'Snack', ''), +('Bengbeng', 2050, 1, 'yuhustore', 'Snack', ''), +('LeoKripikKentang', 3100, 1, 'yuhustore', 'Snack', ''), +('Kangkung', 5300, 1, 'yuhustore', 'Sayuran', ''), +('BayamItali', 5000, 4, 'yuhustore', 'Sayuran', ''), +('ChickenNugget', 30000, 1, 'yuhustore', 'Frozen Food', ''), +('PetaiCHINA', 2500, 1, 'yuhustore', 'Sayuran', ''), +('ToKaeNoi', 5400, 1, 'yuhustore', 'Snack', ''), +('MiGemez', 1200, 1, 'yuhustore', 'Snack', ''); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `user` +-- + +CREATE TABLE IF NOT EXISTS `user` ( + `username` varchar(50) NOT NULL, + `password` varchar(50) DEFAULT NULL, + `email` varchar(50) DEFAULT NULL, + `namalengkap` varchar(50) DEFAULT NULL, + `nohp` varchar(50) DEFAULT NULL, + `provinsi` varchar(50) DEFAULT NULL, + `kotakabupaten` varchar(50) DEFAULT NULL, + `alamat` varchar(50) DEFAULT NULL, + `kodepos` varchar(50) DEFAULT NULL, + `nocredit` varchar(60) DEFAULT NULL, + PRIMARY KEY (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `user` +-- + +INSERT INTO `user` (`username`, `password`, `email`, `namalengkap`, `nohp`, `provinsi`, `kotakabupaten`, `alamat`, `kodepos`, `nocredit`) VALUES +('aditya', '12345678', 'adt@adit.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'), +('aditya2', '12345678', 'aditya@yahoo.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'), +('aditya3', '12345678', 'aditya3@yahoo.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'), +('admin', 'admin123', 'admin@admin.com', 'admin admin', '0000', '-', '-', '-', '0000', NULL), +('bebek', '12345678', 'bebek@bebek.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('budibro', '12341234', 'budi@budi.com', 'budi bro', '0000', 'prov', '-', '-', '0000', NULL), +('budie', '12341234', 'budie@gmail.com', 'budi budi', '0', '-', '-', '-', '0', '12341234'), +('budih', '12345678', 'budie@budi.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'), +('coba2', '12341234', 'coba2@coba2.com', 'coba dua', '0', '-', '-', '-', '0', '12341234'), +('coba3', '12345678', 'coba3@coba.com', 'coba 3', '0', '-', '-', '-', '0', '12341234'), +('cobabaru', '123123123', 'coba@baru.com', 'coba baru', '0', '-', '-', '-', '0', '12341234'), +('cobabro', '12345678', 'coba@bro.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('cobadulu', '12345678', 'coba@dulu.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'), +('cobalagi', '12345678', 'cobalagi@lagi.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('heybro', '12345678', 'hey@bro.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('kucing', '12345678', 'kucing@kucing.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'), +('lalaye', '12345678', 'lalaye@lalaye.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('lalayeye', '12345678', 'lala@yeye.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('popop', '12345678', 'pop@pop.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('riandy', '12345678', 'riandy@riandy.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '123123123'), +('testtest', '12345678', 'test@test.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('username1', '12345678', 'username@username.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('username2', '12345678', 'usernam2@com.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('username4', '12345678', 'username4@com.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('yanti', '12345678', 'yanti@yanti.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'), +('yoibro', '12345678', 'yoi@bro.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL), +('yuhustore', '12345678', 'yuhu@store.com', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4000', '12341234'); + +/*!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 */; diff --git a/src/AjaxAdd.js b/src/AjaxAdd.js new file mode 100644 index 0000000..6719377 --- /dev/null +++ b/src/AjaxAdd.js @@ -0,0 +1,34 @@ + +function AJAXAdd(bro){ + + var elem = document.getElementById(bro).elements; + var params = ""; + url = "NamaBarangValidationServlet"; + + + for(var i = 0; i < elem.length; i++){ + if (elem[i].tagName == "SELECT"){ + params += elem[i].name + "=" + encodeURIComponent(elem[i].options[elem[i].selectedIndex].value) + "&"; + }else{ + params += elem[i].name + "=" + encodeURIComponent(elem[i].value) + "&"; + } + } + + if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari + xmlhttp=new XMLHttpRequest(); + }else{// code for IE6, IE5 + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); + } + + xmlhttp.open("POST",url,false); + + xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xmlhttp.setRequestHeader("Content-length", params.length); + xmlhttp.setRequestHeader("Connection", "close"); + xmlhttp.send(params); + + return xmlhttp.responseText; + + + +} diff --git a/src/AjaxEdit.js b/src/AjaxEdit.js new file mode 100644 index 0000000..9b9e035 --- /dev/null +++ b/src/AjaxEdit.js @@ -0,0 +1,34 @@ + +function AJAXEdit(bro){ + + var elem = document.getElementById(bro).elements; + var params = ""; + url = "ENamaBarangValidationServlet"; + + + for(var i = 0; i < elem.length; i++){ + if (elem[i].tagName == "SELECT"){ + params += elem[i].name + "=" + encodeURIComponent(elem[i].options[elem[i].selectedIndex].value) + "&"; + }else{ + params += elem[i].name + "=" + encodeURIComponent(elem[i].value) + "&"; + } + } + + if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari + xmlhttp=new XMLHttpRequest(); + }else{// code for IE6, IE5 + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); + } + + xmlhttp.open("POST",url,false); + + xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xmlhttp.setRequestHeader("Content-length", params.length); + xmlhttp.setRequestHeader("Connection", "close"); + xmlhttp.send(params); + + return xmlhttp.responseText; + + + +} diff --git a/src/AjaxRegister.js b/src/AjaxRegister.js new file mode 100644 index 0000000..8d21b2c --- /dev/null +++ b/src/AjaxRegister.js @@ -0,0 +1,54 @@ + + +function AJAXRegister(lol){ + var elem2= document.getElementById("cardnumber"); + var elem = document.getElementById(lol); + + var params = ""; + if (lol=="rusername"){ + url = "UsernameValidationServlet"; + }else if (lol=="email"){ + url="EmailValidationServlet"; + }else if (lol=="cardnumber"){ + url ="CardNumberValidationServlet"; + }else if (lol=="namecard"){ + url="NameCardValidationServlet"; + }else if (lol=="expiredate"){ + url="ExpireDateValidationServlet"; + } + + if (elem.tagName == "SELECT"){ + params += elem.name + "=" + encodeURIComponent(elem.options[elem.selectedIndex].value) + "&"; + }else{ + if (lol=="namecard" || lol=="expiredate"){ + + params += elem.name + "=" + encodeURIComponent(elem.value) + "&" + elem2.name + "=" + encodeURIComponent(elem2.value) + "&"; + }else{ + params += elem.name + "=" + encodeURIComponent(elem.value); + } + } + + + if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari + xmlhttp=new XMLHttpRequest(); + }else{// code for IE6, IE5 + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); + } + xmlhttp.open("POST",url,false); + + xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + + xmlhttp.send(params); + + if (xmlhttp.responseText=='true'){ + + return true; + }else{ + + return false; + } + + + + +} diff --git a/src/Ajaxlogin.js b/src/Ajaxlogin.js new file mode 100644 index 0000000..143cab8 --- /dev/null +++ b/src/Ajaxlogin.js @@ -0,0 +1,34 @@ + +function AJAXPost(){ + + var elem = document.getElementById("login").elements; + var params = ""; + url = "LoginServlet"; + + + for(var i = 0; i < elem.length; i++){ + if (elem[i].tagName == "SELECT"){ + params += elem[i].name + "=" + encodeURIComponent(elem[i].options[elem[i].selectedIndex].value) + "&"; + }else{ + params += elem[i].name + "=" + encodeURIComponent(elem[i].value) + "&"; + } + } + + if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari + xmlhttp=new XMLHttpRequest(); + }else{// code for IE6, IE5 + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); + } + + xmlhttp.open("POST",url,false); + + xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xmlhttp.setRequestHeader("Content-length", params.length); + xmlhttp.setRequestHeader("Connection", "close"); + xmlhttp.send(params); + + return xmlhttp.responseText; + + + +} diff --git a/src/Beras.jsp b/src/Beras.jsp new file mode 100644 index 0000000..bd9dde5 --- /dev/null +++ b/src/Beras.jsp @@ -0,0 +1,125 @@ +<% + int jumlahberas = 0; + if (session.getAttribute("jumlahberas")!=null){ + }else{ + response.sendRedirect("getberas"); + } + +%> + + + + + Beras + + + + +
+ + + + +

Products in "Beras" Category

+
+ + +
+ + + +
+ + +
+ + <%String str =""; + int test = (Integer)session.getAttribute("jumlahberas"); + if (test>Integer.parseInt(request.getParameter("l"))){ + test = Integer.parseInt(request.getParameter("l")); + } + for (int i =Integer.parseInt(request.getParameter("f"));i<=test;i++){ %> +
+
+
+ .jpg" alt=""/> +
+
+

"><%str =(String)session.getAttribute("bnama"+i);out.print(str);%>

+

Harga: <% int intr =(Integer)session.getAttribute("bharga"+i);out.print(intr);%> /kg

+ +
+
','<%out.print("cartJumProduk"+i);%>')" accept-charset='UTF-8'> + + + + + " name="cartNama"> + " name="cartHarga"> + " id="<%out.print("cartJumProduk"+i);%>" name="cartJumProduk"> + " name="cartKategori"> + +
+
+ +
+
+
+ <%}%> +
+ +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/src/Daging.jsp b/src/Daging.jsp new file mode 100644 index 0000000..fbe4ea7 --- /dev/null +++ b/src/Daging.jsp @@ -0,0 +1,125 @@ +<% + int jumlahdaging = 0; + if (session.getAttribute("jumlahdaging")!=null){ + }else{ + response.sendRedirect("getdaging"); + } + +%> + + + + + Daging + + + + +
+ + + + +

Products in "Daging" Category

+
+ + +
+ + + +
+ + +
+ + <%String str =""; + int test = (Integer)session.getAttribute("jumlahdaging"); + if (test>Integer.parseInt(request.getParameter("l"))){ + test = Integer.parseInt(request.getParameter("l")); + } + for (int i =Integer.parseInt(request.getParameter("f"));i<=test;i++){ %> +
+
+
+ .jpg" alt=""/> +
+
+

"><%str =(String)session.getAttribute("dnama"+i);out.print(str);%>

+

Harga: <% int intr =(Integer)session.getAttribute("dharga"+i);out.print(intr);%> /kg

+ +
+
','<%out.print("cartJumProduk"+i);%>')" accept-charset='UTF-8'> + + + + + " name="cartNama"> + " name="cartHarga"> + " id="<%out.print("cartJumProduk"+i);%>" name="cartJumProduk"> + " name="cartKategori"> + +
+
+ +
+
+
+ <%}%> +
+ +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/src/Frozen.jsp b/src/Frozen.jsp new file mode 100644 index 0000000..46a7b54 --- /dev/null +++ b/src/Frozen.jsp @@ -0,0 +1,125 @@ +<% + int jumlahfrozen = 0; + if (session.getAttribute("jumlahfrozen")!=null){ + }else{ + response.sendRedirect("getfrozen"); + } + +%> + + + + + Frozen + + + + +
+ + + + +

Products in "Frozen" Category

+
+ + +
+ + + +
+ + +
+ + <%String str =""; + int test = (Integer)session.getAttribute("jumlahfrozen"); + if (test>Integer.parseInt(request.getParameter("l"))){ + test = Integer.parseInt(request.getParameter("l")); + } + for (int i =Integer.parseInt(request.getParameter("f"));i<=test;i++){ %> +
+
+
+ .jpg" alt=""/> +
+
+

"><%str =(String)session.getAttribute("fnama"+i);out.print(str);%>

+

Harga: <% int intr =(Integer)session.getAttribute("fharga"+i);out.print(intr);%> /kg

+ +
+
','<%out.print("cartJumProduk"+i);%>')" accept-charset='UTF-8'> + + + + + " name="cartNama"> + " name="cartHarga"> + " id="<%out.print("cartJumProduk"+i);%>" name="cartJumProduk"> + " name="cartKategori"> + +
+
+ +
+
+
+ <%}%> +
+ +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/src/Sayuran.jsp b/src/Sayuran.jsp new file mode 100644 index 0000000..3c1431b --- /dev/null +++ b/src/Sayuran.jsp @@ -0,0 +1,126 @@ +<% + int jumlahsayuran = 0; + if (session.getAttribute("jumlahsayuran")!=null){ + }else{ + response.sendRedirect("getsayuran"); + } + +%> + + + + + Sayuran + + + + +
+ + + + +

Products in "Sayuran" Category

+
+ + +
+ + + +
+ + +
+ + <%String str =""; + int test = (Integer)session.getAttribute("jumlahsayuran"); + if (test>Integer.parseInt(request.getParameter("l"))){ + test = Integer.parseInt(request.getParameter("l")); + } + for (int i =Integer.parseInt(request.getParameter("f"));i<=test;i++){ + %> +
+
+
+ .jpg" alt=""/> +
+
+

"><%str =(String)session.getAttribute("synama"+i);out.print(str);%>

+

Harga: <% int intr =(Integer)session.getAttribute("syharga"+i);out.print(intr);%> /kg

+ +
+
','<%out.print("cartJumProduk"+i);%>')" accept-charset='UTF-8'> + + + + + " name="cartNama"> + " name="cartHarga"> + " id="<%out.print("cartJumProduk"+i);%>" name="cartJumProduk"> + " name="cartKategori"> + +
+
+ +
+
+
+ <%}%> +
+ +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/src/ShoppingBag.jsp b/src/ShoppingBag.jsp new file mode 100644 index 0000000..9f429f2 --- /dev/null +++ b/src/ShoppingBag.jsp @@ -0,0 +1,107 @@ +<% + if (session.getAttribute("username")==null){ + response.sendRedirect("registrasi.jsp"); + }else{ + + } + +%> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + + + + Shopping Bag + + + +
+ + + + +

Your Shopping Bag

+ + + + +
+
+
+ + <%int i=0;%> + + + +
+ <%i++;%> +

+

Harga : + Jumlah : + + + + " name="nmb" value=''> + + +
Kategori : +
Jumlah Harga : Rp

+
+
+ + +
')"> + +

Total: Rp

+ + +
+ +
+
+
+ + + + +
+ + \ No newline at end of file diff --git a/src/Snack.jsp b/src/Snack.jsp new file mode 100644 index 0000000..4118ec7 --- /dev/null +++ b/src/Snack.jsp @@ -0,0 +1,125 @@ +<% + int jumlahsnack = 0; + if (session.getAttribute("jumlahsnack")!=null){ + }else{ + response.sendRedirect("getsnack"); + } + +%> + + + + + Snack + + + + +
+ + + + +

Products in "Snack" Category

+
+ + +
+ + + +
+ + +
+ + <%String str =""; + int test = (Integer)session.getAttribute("jumlahsnack"); + if (test>Integer.parseInt(request.getParameter("l"))){ + test = Integer.parseInt(request.getParameter("l")); + } + for (int i =Integer.parseInt(request.getParameter("f"));i<=test;i++){ %> +
+
+
+ .jpg" alt=""/> +
+
+

"><%str =(String)session.getAttribute("snnama"+i);out.print(str);%>

+

Harga: <% int intr =(Integer)session.getAttribute("snharga"+i);out.print(intr);%> /kg

+ +
+
','<%out.print("cartJumProduk"+i);%>')" accept-charset='UTF-8'> + + + + + " name="cartNama"> + " name="cartHarga"> + " id="<%out.print("cartJumProduk"+i);%>" name="cartJumProduk"> + " name="cartKategori"> + +
+
+ +
+
+
+ <%}%> +
+ +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/src/WEB-INF/classes/Coba.class b/src/WEB-INF/classes/Coba.class new file mode 100644 index 0000000..68dfb61 Binary files /dev/null and b/src/WEB-INF/classes/Coba.class differ diff --git a/src/WEB-INF/classes/Coba.java b/src/WEB-INF/classes/Coba.java new file mode 100644 index 0000000..d59894c --- /dev/null +++ b/src/WEB-INF/classes/Coba.java @@ -0,0 +1,33 @@ +// Import required java libraries +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; + +// Extend HttpServlet class +public class Coba extends HttpServlet { + + private String message; + + public void init() throws ServletException + { + // Do required initialization + message = "Hello"; + } + + public void doGet(HttpServletRequest request, + HttpServletResponse response) + throws ServletException, IOException + { + // Set response content type + response.setContentType("text/html"); + + // Actual logic goes here. + PrintWriter out = response.getWriter(); + out.println("

" + message + "

"); + } + + public void destroy() + { + // do nothing. + } +} \ No newline at end of file diff --git a/src/WEB-INF/classes/npackage/Barang.class b/src/WEB-INF/classes/npackage/Barang.class new file mode 100644 index 0000000..a2e10d6 Binary files /dev/null and b/src/WEB-INF/classes/npackage/Barang.class differ diff --git a/src/WEB-INF/classes/npackage/Barang.java b/src/WEB-INF/classes/npackage/Barang.java new file mode 100644 index 0000000..ed4d0c0 --- /dev/null +++ b/src/WEB-INF/classes/npackage/Barang.java @@ -0,0 +1,75 @@ +package npackage; +import java.util.ArrayList; + +public class Barang{ + private int id; + private String nama; + private int harga; + private String kategori; + private int jumlah; + private String deskripsi; + + + public Barang(){ + id=-1; + nama=""; + harga=-1; + kategori=""; + jumlah=-1; + deskripsi=""; + } + + public Barang(int id_,String nama_, int harga_,String kategori_,int jumlah_){ + id=id_; + nama=nama_; + harga=harga_; + kategori=kategori_; + jumlah=jumlah_; + deskripsi=""; + } + + public int getId(){ + return id; + } + + public String getNama(){ + return nama; + } + + public int getHarga(){ + return harga; + } + + public String getKategori(){ + return kategori; + } + + public String getDeskripsi(){ + return deskripsi; + } + + public int getJumlah(){ + return jumlah; + } + + public void setId(int id_){ + id=id_; + } + public void setNama(String nama_){ + nama=nama_; + } + public void setHarga(int harga_){ + harga=harga_; + } + + public void setDeskripsi(String deskripsi_){ + deskripsi=deskripsi_; + } + public void setKategori(String kategori_){ + kategori=kategori_; + } + public void setJumlah(int jumlah_){ + jumlah=jumlah_; + } + +} \ No newline at end of file diff --git a/src/WEB-INF/classes/npackage/CardNumberValidationServlet.class b/src/WEB-INF/classes/npackage/CardNumberValidationServlet.class new file mode 100644 index 0000000..66cee46 Binary files /dev/null and b/src/WEB-INF/classes/npackage/CardNumberValidationServlet.class differ diff --git a/src/WEB-INF/classes/npackage/CardNumberValidationServlet.java b/src/WEB-INF/classes/npackage/CardNumberValidationServlet.java new file mode 100644 index 0000000..91ca5bb --- /dev/null +++ b/src/WEB-INF/classes/npackage/CardNumberValidationServlet.java @@ -0,0 +1,60 @@ +package npackage; + +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; +/** + * Servlet implementation class LoginServlet + */ +public class CardNumberValidationServlet extends HttpServlet { + + +@Override +public void doGet(HttpServletRequest request, + HttpServletResponse response) + throws IOException, ServletException +{ + doPost(request, response); +} + +@Override +public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, java.io.IOException { + +try +{ + + UserBean user = new UserBean(); + + user.setQuery("SELECT * FROM creditcard WHERE number='" + + request.getParameter("cardnumber") + + "'"); + + user = UserDAO.login(user); + + boolean coba = user.isValid(); + + if (user.isValid()) + { + + response.getWriter().print(true); + } + + else + response.getWriter().print(false); + + +} + + +catch (Throwable theException) +{ + System.out.println(theException); +} + } + + + + + + } diff --git a/src/WEB-INF/classes/npackage/Cart.class b/src/WEB-INF/classes/npackage/Cart.class new file mode 100644 index 0000000..1a6a4c6 Binary files /dev/null and b/src/WEB-INF/classes/npackage/Cart.class differ diff --git a/src/WEB-INF/classes/npackage/Cart.java b/src/WEB-INF/classes/npackage/Cart.java new file mode 100644 index 0000000..6e9b6bb --- /dev/null +++ b/src/WEB-INF/classes/npackage/Cart.java @@ -0,0 +1,130 @@ +package npackage; + +import java.util.ArrayList; + +public class Cart{ + private ArrayList allCartItems = new ArrayList(); + private int hargaTotal ; + + public int getItemCount() { + return allCartItems.size(); + } + + public void remove() { + allCartItems.clear(); + hargaTotal = 0; + } + + public void deleteCartItem(String index) { + int itemIndex = 0; + try { + itemIndex = Integer.parseInt(index); + allCartItems.remove(itemIndex - 1); + calculateHargaTotal(); + }catch(NumberFormatException nfe) { + System.out.println("Error while deleting cart item: "+nfe.getMessage()); + nfe.printStackTrace(); + } + } + + public void updateCartItem(String strItemIndex, String strQuantity) { + int jumHarga = 0; + int harga = 0; + int jumlah = 0; + int index = 0; + CartItem cartItem = null; + try { + index = Integer.parseInt(strItemIndex); + jumlah = Integer.parseInt(strQuantity); + if(jumlah>0) { + cartItem = (CartItem)allCartItems.get(index-1); + harga = cartItem.getHarga(); + jumHarga = harga*jumlah; + cartItem.setJumlah(jumlah); + cartItem.setJumHarga(jumHarga); + calculateHargaTotal(); + } + } catch (NumberFormatException nfe) { + System.out.println("Error while updating cart: "+nfe.getMessage()); + nfe.printStackTrace(); + } + + } + + public void addCartItem(String nama, String strHarga, String kategori, String strQuantity, String detail, String strJumProduk) { + int jumHarga = 0; + int harga = 0; + int jumlah = 0; + int jumProduk = 0; + CartItem cartItem = new CartItem(); + boolean ada = false; + try { + harga = Integer.parseInt(strHarga); + jumlah = Integer.parseInt(strQuantity); + jumProduk = Integer.parseInt(strJumProduk); + + CartItem item = new CartItem(); + int i = 0; + while(i0 && ada==false) { + jumHarga = harga*jumlah; + cartItem.setNama(nama); + cartItem.setHarga(harga); + cartItem.setKategori(kategori); + cartItem.setJumlah(jumlah); + cartItem.setDetail(detail); + cartItem.setJumHarga(jumHarga); + cartItem.setJumProduk(jumProduk); + allCartItems.add(cartItem); + calculateHargaTotal(); + } + } catch (NumberFormatException nfe) { + System.out.println("Error while parsing from String to primitive types when adding item: "+nfe.getMessage()); + nfe.printStackTrace(); + } + } + + public void addCartItem(CartItem cartItem) { + allCartItems.add(cartItem); + } + + public CartItem getCartItem(int index) { + CartItem cartItem = null; + if(allCartItems.size()>index) { + cartItem = (CartItem) allCartItems.get(index); + } + return cartItem; + } + + public ArrayList getCartItems() { + return allCartItems; + } + public void setCartItems(ArrayList allCartItems_) { + allCartItems = allCartItems_; + } + public int getHargaTotal() { + return hargaTotal; + } + public void setHargaTotal(int hargaTotal_) { + hargaTotal = hargaTotal_; + } + + protected void calculateHargaTotal() { + int hargaTotal = 0; + for(int counter=0;counter= 0){ + UserBean user = new UserBean(); + user.setType("inserttransaction"); + user.setQuery("insert into transactionlog values('"+nama+"',"+harga+", "+quantity+", '"+username+"', '"+kategori+"', '"+detail+"')"); + + user = UserDAO.login(user); + updateDB(cart.getCartItem(i), sum); + } + } + cart.remove(); + response.sendRedirect("ShoppingBag.jsp"); + }catch (Throwable theException){ + System.out.println(theException); + } + +} + +} \ No newline at end of file diff --git a/src/WEB-INF/classes/npackage/CartItem.class b/src/WEB-INF/classes/npackage/CartItem.class new file mode 100644 index 0000000..49a1060 Binary files /dev/null and b/src/WEB-INF/classes/npackage/CartItem.class differ diff --git a/src/WEB-INF/classes/npackage/CartItem.java b/src/WEB-INF/classes/npackage/CartItem.java new file mode 100644 index 0000000..7fcc473 --- /dev/null +++ b/src/WEB-INF/classes/npackage/CartItem.java @@ -0,0 +1,81 @@ +package npackage; + +public class CartItem{ + private String nama; + private int harga; + private String kategori; + private int jumlah; //banyaknya pembelian + private String detail; + private int jumHarga; + private int jumProduk; //sisa produk di DB + + public CartItem(){ + nama=""; + harga=-1; + kategori=""; + jumlah=-1; + detail=""; + jumHarga=0; + jumProduk=0; + } + + public CartItem(int id_,String nama_, int harga_,String kategori_,int jumlah_, String detail_, int jumHarga_, int jumProduk_,String index_){ + nama=nama_; + harga=harga_; + kategori=kategori_; + jumlah=jumlah_; + detail=detail_; + jumHarga=jumHarga_; + jumProduk = jumProduk_; + } + + public String getNama(){ + return nama; + } + + public int getHarga(){ + return harga; + } + + public String getKategori(){ + return kategori; + } + + public int getJumlah(){ + return jumlah; + } + + public String getDeatail(){ + return detail; + } + + public int getJumHarga(){ + return jumHarga; + } + public int getJumProduk(){ + return jumProduk; + } + + public void setNama(String nama_){ + nama=nama_; + } + public void setHarga(int harga_){ + harga=harga_; + } + public void setKategori(String kategori_){ + kategori=kategori_; + } + public void setJumlah(int jumlah_){ + jumlah=jumlah_; + } + + public void setDetail(String detail_){ + detail=detail_; + } + public void setJumHarga(int jumHarga_){ + jumHarga=jumHarga_; + } + public void setJumProduk(int jumProduk_){ + jumProduk=jumProduk_; + } +} \ No newline at end of file diff --git a/src/WEB-INF/classes/npackage/ConnectionManager.class b/src/WEB-INF/classes/npackage/ConnectionManager.class new file mode 100644 index 0000000..d24d13b Binary files /dev/null and b/src/WEB-INF/classes/npackage/ConnectionManager.class differ diff --git a/src/WEB-INF/classes/npackage/ConnectionManager.java b/src/WEB-INF/classes/npackage/ConnectionManager.java new file mode 100644 index 0000000..53cd49d --- /dev/null +++ b/src/WEB-INF/classes/npackage/ConnectionManager.java @@ -0,0 +1,45 @@ +package npackage; + + import java.sql.*; + import java.util.*; + + + public class ConnectionManager { + + static Connection con; + static String url; + + public static Connection getConnection() + { + + try + { + String url = "jdbc:mysql://localhost:3306/datauser"; + + // assuming "DataSource" is your DataSource name + + Class.forName("com.mysql.jdbc.Driver"); + + try + { + con = DriverManager.getConnection(url,"root",""); + + // assuming your SQL Server's username is "username" + // and password is "password" + + } + + catch (SQLException ex) + { + ex.printStackTrace(); + } + } + + catch(ClassNotFoundException e) + { + System.out.println(e); + } + + return con; +} + } \ No newline at end of file diff --git a/src/WEB-INF/classes/npackage/DeleteSelectedItem.class b/src/WEB-INF/classes/npackage/DeleteSelectedItem.class new file mode 100644 index 0000000..7a86ce6 Binary files /dev/null and b/src/WEB-INF/classes/npackage/DeleteSelectedItem.class differ diff --git a/src/WEB-INF/classes/npackage/DeleteSelectedItem.java b/src/WEB-INF/classes/npackage/DeleteSelectedItem.java new file mode 100644 index 0000000..b92af17 --- /dev/null +++ b/src/WEB-INF/classes/npackage/DeleteSelectedItem.java @@ -0,0 +1,52 @@ +package npackage; + +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; +/** + * Servlet implementation class LoginServlet + */ +public class DeleteSelectedItem extends HttpServlet { + + +@Override +public void doGet(HttpServletRequest request, + HttpServletResponse response) + throws IOException, ServletException +{ + doPost(request, response); +} + +@Override +public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, java.io.IOException { + +try +{ + UserBean user = new UserBean(); + + String[] checkdel = request.getParameterValues("cdelete"); + if (request.getParameterValues("cdelete")!=null){ + for(int i=0;i search = new ArrayList(); + ArrayList beras = new ArrayList(); + ArrayList daging = new ArrayList(); + ArrayList sayuran = new ArrayList(); + ArrayList frozen = new ArrayList(); + ArrayList snack = new ArrayList(); + Barang barang = new Barang(); + + public boolean valid; + + + public ArrayList getberas(){ + return beras; + } + + public void clearArraylist(){ + search = new ArrayList(); + beras = new ArrayList(); + daging = new ArrayList(); + sayuran = new ArrayList(); + frozen = new ArrayList(); + snack = new ArrayList(); + + } + public void setberas(Barang newberas){ + beras.add(newberas); + } + public ArrayList getdaging(){ + return daging; + } + + public void setdaging(Barang newdaging){ + daging.add(newdaging); + } + public ArrayList getsayuran(){ + return sayuran; + } + + public void setsayuran(Barang newsayuran){ + sayuran.add(newsayuran); + } + public ArrayList getfrozen(){ + return frozen; + } + + public void setfrozen(Barang newfrozen){ + frozen.add(newfrozen); + } + public ArrayList getsnack(){ + return snack; + } + + public void setsnack(Barang newsnack){ + snack.add(newsnack); + } + public Barang getbarang(){ + return barang; + } + + public void setbarang(Barang newbarang){ + barang = newbarang; + } + + + + + public ArrayList getsearch(){ + return search; + } + + public void setsearch(Barang newsearch){ + search.add(newsearch); + } + + public String getType(){ + return type; + } + + public void setType(String newType){ + type = newType; + } + + public String getbestbuy1(){ + return bestbuy1; + } + public void setbestbuy1(String newbestbuy1){ + bestbuy1 = newbestbuy1; + } + + public void setbestbuy2(String newbestbuy2){ + bestbuy2 = newbestbuy2; + } + + public String getbestbuy2(){ + return bestbuy2; + } + public String getbestbuy3(){ + return bestbuy3; + } + + public void setbestbuy3(String newbestbuy3){ + bestbuy3 = newbestbuy3; + } + + public String getQuery() { + return query; + } + + public void setQuery(String newQuery) { + query = newQuery; + } + public String getQueryDua() { + return querydua; + } + + public void setQueryDua(String newQuerydua) { + querydua = newQuerydua; + } + + + public void setJumlahTransaksi(String newJT) { + jumlahtransaksi = newJT; + } + + public String getJumlahTransaksi() { + return jumlahtransaksi; + } + + public void setEmail(String newEmail) { + email = newEmail; + } + + public String getEmail() { + return email; + } + + public void setNamaLengkap(String newNamaLengkap) { + namalengkap = newNamaLengkap; + } + public String getNamaLengkap() { + return namalengkap; + } + + public void setNoHP(String newNoHP) { + nohp = newNoHP; + } + public String getNoHP() { + return nohp; + } + + public void setProvinsi(String newProvinsi) { + provinsi = newProvinsi; + } + public String getProvinsi() { + return provinsi; + } + public void setKotaKabupaten(String newKotaKabupaten) { + kotakabupaten = newKotaKabupaten; + } + public String getKotaKabupaten() { + return kotakabupaten; + } + + public void setAlamat(String newAlamat) { + alamat = newAlamat; + } + public String getAlamat() { + return alamat; + } + + public void setKodePos(String newKodePos) { + kodepos = newKodePos; + } + public String getKodePos() { + return kodepos; + } + + + public String getPassword() { + return password; + } + + public void setPassword(String newPassword) { + password = newPassword; + } + + public String getNoCredit() { + return nocredit; + } + + public void setNoCredit(String newNoCredit) { + nocredit = newNoCredit; + } + + + public String getUsername() { + return username; + } + + public void setUserName(String newUsername) { + username = newUsername; + } + + + public boolean isValid() { + return valid; + } + + public void setValid(boolean newValid) { + valid = newValid; + } +} \ No newline at end of file diff --git a/src/WEB-INF/classes/npackage/UserDAO.class b/src/WEB-INF/classes/npackage/UserDAO.class new file mode 100644 index 0000000..5a821ef Binary files /dev/null and b/src/WEB-INF/classes/npackage/UserDAO.class differ diff --git a/src/WEB-INF/classes/npackage/UserDAO.java b/src/WEB-INF/classes/npackage/UserDAO.java new file mode 100644 index 0000000..485b9a8 --- /dev/null +++ b/src/WEB-INF/classes/npackage/UserDAO.java @@ -0,0 +1,187 @@ +package npackage; + + import java.text.*; + import java.util.*; + import java.sql.*; + + public class UserDAO + { + static Connection currentCon = null; + static ResultSet rs = null; + + + + public static UserBean login(UserBean bean) { + + //preparing some objects for connection + Statement stmt = null; + + + + String searchQuery =bean.getQuery(); + + + + + try + { + //connect to DB + currentCon = ConnectionManager.getConnection(); + stmt=currentCon.createStatement(); + + stmt.execute(searchQuery); + + + boolean more = false; + rs = stmt.getResultSet(); + if (rs!=null){ + more = rs.next(); + } + + // if user does not exist set the isValid variable to false + //if user exists set the isValid variable to true + if (more){ + if (bean.getType()=="login"){ + + bean.setUserName(rs.getString("username")); + bean.setPassword(rs.getString("password")); + bean.setNoCredit(rs.getString("nocredit")); + + } + if (bean.getType()=="getdatamember"){ + bean.setUserName(rs.getString("username")); + bean.setPassword(rs.getString("password")); + bean.setNoCredit(rs.getString("nocredit")); + bean.setEmail(rs.getString("email")); + bean.setNamaLengkap(rs.getString("namalengkap")); + bean.setNoHP(rs.getString("nohp")); + bean.setProvinsi(rs.getString("provinsi")); + bean.setKotaKabupaten(rs.getString("kotakabupaten")); + bean.setAlamat(rs.getString("alamat")); + bean.setKodePos(rs.getString("kodepos")); + } + if (bean.getType()=="getjumlahtransaksi"){ + bean.setJumlahTransaksi(rs.getString("COUNT")); + } + if(bean.getType()=="getbestbuy"){ + bean.setbestbuy1(rs.getString(1)); + rs.next(); + bean.setbestbuy2(rs.getString(1)); + rs.next(); + bean.setbestbuy3(rs.getString(1)); + } + if (bean.getType()=="getsearch"){ + Barang barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + barang.setDeskripsi(rs.getString("Deskripsi")); + bean.setsearch(barang); + while (rs.next()){ + //ambil hasil result search + barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + barang.setDeskripsi(rs.getString("Deskripsi")); + bean.setsearch(barang); + + } + + + } + if (bean.getType()=="getberas"){ + Barang barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + bean.setberas(barang); + while (rs.next()){ + //ambil hasil result search + barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + bean.setberas(barang); + + } + } + if (bean.getType()=="getdaging"){ + Barang barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + bean.setdaging(barang); + while (rs.next()){ + //ambil hasil result search + barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + bean.setdaging(barang); + + } + } + if (bean.getType()=="getsayuran"){ + Barang barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + bean.setsayuran(barang); + while (rs.next()){ + //ambil hasil result search + barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + bean.setsayuran(barang); + + } + } + if (bean.getType()=="getfrozen"){ + Barang barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + bean.setfrozen(barang); + while (rs.next()){ + //ambil hasil result search + barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + bean.setfrozen(barang); + + } + } + if (bean.getType()=="getsnack"){ + Barang barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + bean.setsnack(barang); + while (rs.next()){ + //ambil hasil result search + barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + bean.setsnack(barang); + + } + } + if (bean.getType()=="getbarang"){ + Barang barang = new Barang(rs.getInt("IdBarang"),rs.getString("NamaBarang"),rs.getInt("Harga"),rs.getString("Kategori"),rs.getInt("Jumlah")); + barang.setDeskripsi(rs.getString("Deskripsi")); + bean.setbarang(barang); + } + + + bean.setValid(true); + }else{ + bean.setValid(false); + + } + + } + + catch (Exception ex) + { + System.out.println("Log In failed: An Exception has occurred! " + ex); + } + + //some exception handling + finally + { + if (rs != null) { + try { + rs.close(); + } catch (Exception e) {} + rs = null; + } + + if (stmt != null) { + try { + stmt.close(); + } catch (Exception e) {} + stmt = null; + } + + if (currentCon != null) { + try { + currentCon.close(); + } catch (Exception e) { + } + + currentCon = null; + } + } + +return bean; + + } + } \ No newline at end of file diff --git a/src/WEB-INF/classes/npackage/UsernameValidationServlet.class b/src/WEB-INF/classes/npackage/UsernameValidationServlet.class new file mode 100644 index 0000000..f24b890 Binary files /dev/null and b/src/WEB-INF/classes/npackage/UsernameValidationServlet.class differ diff --git a/src/WEB-INF/classes/npackage/UsernameValidationServlet.java b/src/WEB-INF/classes/npackage/UsernameValidationServlet.java new file mode 100644 index 0000000..4d2449c --- /dev/null +++ b/src/WEB-INF/classes/npackage/UsernameValidationServlet.java @@ -0,0 +1,61 @@ +package npackage; + +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; +/** + * Servlet implementation class LoginServlet + */ +public class UsernameValidationServlet extends HttpServlet { + + +@Override +public void doGet(HttpServletRequest request, + HttpServletResponse response) + throws IOException, ServletException +{ + doPost(request, response); +} + +@Override +public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, java.io.IOException { + +try +{ + + UserBean user = new UserBean(); + user.setUserName(request.getParameter("rusername")); + user.setQuery("select * from user where username='" + + request.getParameter("rusername") + + "'"); + + user = UserDAO.login(user); + + boolean coba = user.isValid(); + + if (!user.isValid()) + { + + + response.getWriter().print(true); + } + + else + response.getWriter().print(false); + + +} + + +catch (Throwable theException) +{ + System.out.println(theException); +} + } + + + + + + } diff --git a/src/WEB-INF/classes/npackage/editbarang.class b/src/WEB-INF/classes/npackage/editbarang.class new file mode 100644 index 0000000..213332d Binary files /dev/null and b/src/WEB-INF/classes/npackage/editbarang.class differ diff --git a/src/WEB-INF/classes/npackage/editbarang.java b/src/WEB-INF/classes/npackage/editbarang.java new file mode 100644 index 0000000..8656ce6 --- /dev/null +++ b/src/WEB-INF/classes/npackage/editbarang.java @@ -0,0 +1,118 @@ +package npackage; + +import java.io.File; +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.MultipartConfig; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.Part; + +@WebServlet("/FileUploadServlet") +@MultipartConfig( + fileSizeThreshold=1024*1024*10, // 10 MB + maxFileSize=1024*1024*50, // 50 MB + maxRequestSize=1024*1024*100) // 100 MB +public class editbarang extends HttpServlet { + + private static final long serialVersionUID = 205242440643911308L; + + /** + * Directory where uploaded files will be saved, its relative to + * the web application directory. + */ + private String UPLOAD_DIR = "res/img/product"; + + protected void doPost(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + + UserBean user = new UserBean(); + user.setType("insertdata"); + user.setQuery("UPDATE barang SET namabarang='"+ + request.getParameter("enamabarang")+"', harga='"+ + request.getParameter("ehargabarang")+"', jumlah='"+ + request.getParameter("ejumlahbarang")+"', deskripsi='"+ + request.getParameter("edeskripsibarang")+"' WHERE namabarang='"+ + request.getParameter("enamabarangtemp")+"'"); + + user = UserDAO.login(user); + + + // gets absolute path of the web application + String applicationPath = request.getServletContext().getRealPath(""); + // constructs path of the directory to save uploaded file + String uploadFilePath = applicationPath + File.separator + UPLOAD_DIR; + + // creates the save directory if it does not exists + File fileSaveDir = new File(uploadFilePath); + if (!fileSaveDir.exists()) { + fileSaveDir.mkdirs(); + } + String new1 =fileSaveDir.getAbsolutePath()+"\\"+request.getParameter("enamabarangtemp")+".jpg"; + String new2 =fileSaveDir.getAbsolutePath()+"\\"+request.getParameter("enamabarang")+".jpg"; + System.out.println("new1="+new1); + File file1 = new File(new1); + File file2 = new File(new2); + + + try { + boolean b; + b=file1.renameTo(file2); + } catch (SecurityException ex) { + System.out.println("SecurityException") ; + ex.printStackTrace (); + } catch (NullPointerException npe) { + System.out.println("NullPointerException") ; + npe.printStackTrace (); + } + + System.out.println("Upload File Directory="+fileSaveDir.getAbsolutePath()); + + String fileName = null; + fileName = getFileName(request.getPart("efilebarang")); + //Get all the parts from request and write it to the file on server + String namab = request.getParameter("enamabarang"); + if (!fileName.equals("")){ + request.getPart("efilebarang").write(uploadFilePath + File.separator + namab + ".jpg"); + + request.setAttribute("message", fileName + " File uploaded successfully!"); + } + response.sendRedirect("getadmin"); + } + + /** + * Utility method to get file name from HTTP header content-disposition + */ + private String getFileName(Part part) { + String contentDisp = part.getHeader("content-disposition"); + + String[] tokens = contentDisp.split(";"); + for (String token : tokens) { + if (token.trim().startsWith("filename")) { + return token.substring(token.indexOf("=") + 2, token.length()-1); + } + } + return ""; + } + @Override + +public void doGet(HttpServletRequest request, + HttpServletResponse response) + throws IOException, ServletException +{ + doPost(request, response); +} +} + + + + + + + + + + diff --git a/src/WEB-INF/classes/npackage/getadmin.class b/src/WEB-INF/classes/npackage/getadmin.class new file mode 100644 index 0000000..8bd2eb3 Binary files /dev/null and b/src/WEB-INF/classes/npackage/getadmin.class differ diff --git a/src/WEB-INF/classes/npackage/getadmin.java b/src/WEB-INF/classes/npackage/getadmin.java new file mode 100644 index 0000000..502f549 --- /dev/null +++ b/src/WEB-INF/classes/npackage/getadmin.java @@ -0,0 +1,156 @@ +package npackage; + +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; +import java.util.ArrayList; +/** + * Servlet implementation class LoginServlet + */ +public class getadmin extends HttpServlet { + + +@Override +public void doGet(HttpServletRequest request, + HttpServletResponse response) + throws IOException, ServletException +{ + doPost(request, response); +} + +@Override +public void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, java.io.IOException { + + try + { + + UserBean user = new UserBean(); + + user.setType("getsearch"); + + + user.setQuery("SELECT * FROM Barang Where Kategori = 'Beras'" ); + user = UserDAO.login(user); + ArrayList barangs = new ArrayList(); + barangs = user.getsearch(); + + HttpSession session = request.getSession(true); + session.setAttribute("jumlahadmberas",barangs.size()); + for (int i = 0; i(); + barangs = user.getsearch(); + + session.setAttribute("jumlahadmdaging",barangs.size()); + for (int i = 0; i(); + barangs = user.getsearch(); + + session.setAttribute("jumlahadmsayuran",barangs.size()); + for (int i = 0; i(); + barangs = user.getsearch(); + + session.setAttribute("jumlahadmfrozen",barangs.size()); + for (int i = 0; i(); + barangs = user.getsearch(); + + session.setAttribute("jumlahadmsnack",barangs.size()); + for (int i = 0; i berases = new ArrayList(); + berases = user.getberas(); + HttpSession session = request.getSession(true); + session.setAttribute("jumlahberas",berases.size()); + for (int i = 0; i daginges = new ArrayList(); + daginges = user.getdaging(); + HttpSession session = request.getSession(true); + session.setAttribute("jumlahdaging",daginges.size()); + for (int i = 0; i frozenes = new ArrayList(); + frozenes = user.getfrozen(); + HttpSession session = request.getSession(true); + session.setAttribute("jumlahfrozen",frozenes.size()); + for (int i = 0; i sayuranes = new ArrayList(); + sayuranes = user.getsayuran(); + HttpSession session = request.getSession(true); + session.setAttribute("jumlahsayuran",sayuranes.size()); + for (int i = 0; i"+SearchQueryHarga1+")" ); + + + + + user = UserDAO.login(user); + ArrayList barangs = new ArrayList(); + barangs = user.getsearch(); + HttpSession session = request.getSession(true); + session.setAttribute("jumlahsearch",barangs.size()); + for (int i = 0; i snackes = new ArrayList(); + snackes = user.getsnack(); + HttpSession session = request.getSession(true); + session.setAttribute("jumlahsnack",snackes.size()); + for (int i = 0; i +My First Servlet - www.way4code.com + +My First Servlet + + + + /tmp + 20848820 + 418018841 + 1048576 + + + LoginServlet + npackage.LoginServlet + + + CartController + npackage.CartController + + + FileUploadServlet + npackage.FileUploadServlet + + + insertbarang + npackage.insertbarang + + + editbarang + npackage.editbarang + + + DeleteSelectedItem + npackage.DeleteSelectedItem + + + NamaBarangValidationServlet + npackage.NamaBarangValidationServlet + + + ENamaBarangValidationServlet + npackage.ENamaBarangValidationServlet + + + getadmin + npackage.getadmin + + + UpdateServlet + npackage.UpdateServlet + + + getdatamember + npackage.getdatamember + + + getbestbuy + npackage.getbestbuy + + + getsearch + npackage.getsearch + + + getberas + npackage.getberas + + + getdaging + npackage.getdaging + + + getsayuran + npackage.getsayuran + + + getfrozen + npackage.getfrozen + + + getsnack + npackage.getsnack + + + getbarang + npackage.getbarang + + + insertdata + npackage.insertdata + + + insertcreditcard + npackage.insertcreditcard + + + UsernameValidationServlet + npackage.UsernameValidationServlet + + + CardNumberValidationServlet + npackage.CardNumberValidationServlet + + + + EmailValidationServlet + npackage.EmailValidationServlet + + + NameCardValidationServlet + npackage.NameCardValidationServlet + + + ExpireDateValidationServlet + npackage.ExpireDateValidationServlet + + + CookieExample + CookieExample + + + Coba + Coba + + + + UsernameValidationServlet + /UsernameValidationServlet + + + FileUploadServlet + /FileUploadServlet + + + NamaBarangValidationServlet + /NamaBarangValidationServlet + + + ENamaBarangValidationServlet + /ENamaBarangValidationServlet + + + getdatamember + /getdatamember + + + CartController + /CartController + + + DeleteSelectedItem + /DeleteSelectedItem + + + getadmin + /getadmin + + + editbarang + /editbarang + + + getbestbuy + /getbestbuy + + + getsearch + /getsearch + + + getberas + /getberas + + + getdaging + /getdaging + + + getsayuran + /getsayuran + + + getfrozen + /getfrozen + + + getsnack + /getsnack + + + getbarang + /getbarang + + + CardNumberValidationServlet + /CardNumberValidationServlet + + + NameCardValidationServlet + /NameCardValidationServlet + + + ExpireDateValidationServlet + /ExpireDateValidationServlet + + + insertdata + /insertdata + + + insertbarang + /insertbarang + + + insertcreditcard + /insertcreditcard + + + EmailValidationServlet + /EmailValidationServlet + + + + LoginServlet + /LoginServlet + + + UpdateServlet + /UpdateServlet + + + + Coba + /Coba + + + CookieExample + /CookieExample + + \ No newline at end of file diff --git a/src/admin.jsp b/src/admin.jsp new file mode 100644 index 0000000..2992c2c --- /dev/null +++ b/src/admin.jsp @@ -0,0 +1,298 @@ +<% + int jumlahsearch = 0; + if (session.getAttribute("jumlahadmberas")!=null){ + + }else{ + response.sendRedirect("getadmin"); + } +%> + + + + + Halaman Admin + + + + +
+ + + <% if (session.getAttribute("username")!=null){ + String un = (String)session.getAttribute("username"); + if(!un.equals("admin")){ + response.sendRedirect("index.jsp");} + + } %> + + + +
+
+ + [X] close

+ + Nama        : +
+ Harga        : +
+ Kategori    : +
+ Jumlah       : +
+ Deskripsi   : +
+ File Gambar : + +

+ +
+ +
+ +
+
+ [X] close
+ +
+ Nama        : +
+ Harga        : +
+ Jumlah       : +
+ Deskripsi : +
+ File Gambar : + +

+ +
+ +
+ + +
+ + +
+ + + +

+
+ +
+ BERAS +
+ <%String str =""; + String str2=""; + int test = (Integer)session.getAttribute("jumlahadmberas"); + for (int i =1;i<=test;i++){ %> +
+
+
+ + .jpg" alt=""/> +
+
+

"><%str =(String)session.getAttribute("admberasnama"+i);out.print(str);%>

+

Harga: <% int intr =(Integer)session.getAttribute("admberasharga"+i);out.print(intr);%> /kg

+ ">delete       + ','<%out.print((Integer)session.getAttribute("admberasharga"+i));%>','<%out.print((Integer)session.getAttribute("admberasjumlah"+i));%>','<%out.print((String)session.getAttribute("admberasdeskripsi"+i));%>')" value="EDIT"> +
+
+
+ <%}%> +
+ +
+
+ DAGING +
+ <% + str =""; + test = (Integer)session.getAttribute("jumlahadmdaging"); + + for (int i =1;i<=test;i++){ %> +
+
+
+ + .jpg" alt=""/> +
+
+

"><%str =(String)session.getAttribute("admdagingnama"+i);out.print(str);%>

+

Harga: <% int intr =(Integer)session.getAttribute("admdagingharga"+i);out.print(intr);%> /kg

+ ">delete       + ','<%out.print((Integer)session.getAttribute("admdagingharga"+i));%>','<%out.print((Integer)session.getAttribute("admdagingjumlah"+i));%>','<%out.print((String)session.getAttribute("admdagingdeskripsi"+i));%>')" value="EDIT"> +
+
+
+ <%}%> +
+ +
+
+ SAYURAN +
+ <%str =""; + test = (Integer)session.getAttribute("jumlahadmsayuran"); + + for (int i =1;i<=test;i++){ %> +
+
+
+ + .jpg" alt=""/> +
+
+

"><%str =(String)session.getAttribute("admsayurannama"+i);out.print(str);%>

+

Harga: <% int intr =(Integer)session.getAttribute("admsayuranharga"+i);out.print(intr);%> /kg

+ ">delete       + ','<%out.print((Integer)session.getAttribute("admsayuranharga"+i));%>','<%out.print((Integer)session.getAttribute("admsayuranjumlah"+i));%>','<%out.print((String)session.getAttribute("admsayurandeskripsi"+i));%>')" value="EDIT"> +
+
+
+ <%}%> +
+ +
+
+ FROZEN FOOD +
+ <%str =""; + test = (Integer)session.getAttribute("jumlahadmfrozen"); + + for (int i =1;i<=test;i++){ %> +
+
+
+ .jpg" alt=""/> +
+
+

"><%str =(String)session.getAttribute("admfrozennama"+i);out.print(str);%>

+

Harga: <% int intr =(Integer)session.getAttribute("admfrozenharga"+i);out.print(intr);%> /kg

+ ">delete       + ','<%out.print((Integer)session.getAttribute("admfrozenharga"+i));%>','<%out.print((Integer)session.getAttribute("admfrozenjumlah"+i));%>','<%out.print((String)session.getAttribute("admfrozendeskripsi"+i));%>')" value="EDIT"> +
+
+
+ <%}%> +
+ +
+
+ SNACK +
+ <%str =""; + test = (Integer)session.getAttribute("jumlahadmsnack"); + + for (int i =1;i<=test;i++){ %> +
+
+
+ .jpg" alt=""/> +
+
+

"><%str =(String)session.getAttribute("admsnacknama"+i);out.print(str);%>

+

Harga: <% int intr =(Integer)session.getAttribute("admsnackharga"+i);out.print(intr);%> /kg

+ ">delete       + ','<%out.print((Integer)session.getAttribute("admsnackharga"+i));%>','<%out.print((Integer)session.getAttribute("admsnackjumlah"+i));%>','<%out.print((String)session.getAttribute("admsnackdeskripsi"+i));%>')" value="EDIT"> +
+
+
+ <%}%> + + +
+
+ +
+ + +
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/creditcard.jsp b/src/creditcard.jsp new file mode 100644 index 0000000..b8c388c --- /dev/null +++ b/src/creditcard.jsp @@ -0,0 +1,90 @@ + +<% + String name=""; + String value=""; + String valuelagi=null; + Cookie[] cookies = request.getCookies(); + if (cookies!=null){ + for (int i = 0; i < cookies.length; i++) { + Cookie c = cookies[i]; + name = c.getName(); + value = c.getValue(); + + if (name.equals("username")){ + valuelagi=value; + } + session.setAttribute(name, value); + } + } + + if(valuelagi==null){ + response.sendRedirect("registrasi.jsp"); + } + +%> + + + + + + Credit Card + + + + +
+ + + +
+

Credit Card Registration

+ + +
+ +
+

Card Number :

+

+ + +

+
+ +
+

Name On Card :

+

+ + +

+
+ +
+

Expired Date :

+

+ + +

+
+
+ + +
+
+ +
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/detail-barang.jsp b/src/detail-barang.jsp new file mode 100644 index 0000000..2feac7b --- /dev/null +++ b/src/detail-barang.jsp @@ -0,0 +1,69 @@ + + + + + Detail Product + + + + +
+ + + +
+ + +
+
+
+
+ .jpg" alt=""/> +
+
+

"><%=session.getAttribute("namab")%>

+

Harga: <%=session.getAttribute("hargab")%> /kg

+

Deskripsi: <%=session.getAttribute("deskripsib")%>

+
+
','<%out.print("cartJumProduk");%>')" accept-charset='UTF-8'> + + " name="cartQuantity" value="Banyaknya barang.." onfocus="checkclear(this)" onblur="checkempty(this, 'Banyaknya barang..')"> + + + " name="cartNama"> + " name="cartHarga"> + " id="<%out.print("cartJumProduk");%>" name="cartJumProduk"> + " name="cartKategori"> + +
+
+
+
+
+
+ +
+ +
+ + + + + + + \ No newline at end of file diff --git a/src/edit-profile.jsp b/src/edit-profile.jsp new file mode 100644 index 0000000..b97ba40 --- /dev/null +++ b/src/edit-profile.jsp @@ -0,0 +1,185 @@ +<% + + String username = ""; + String password= ""; + String email= ""; + String namalengkap= ""; + String nohp= ""; + String provinsi= ""; + String kotakabupaten= ""; + String alamat= ""; + String kodepos= ""; + String nocredit= ""; + String jumlahtransaksi=""; + String name=""; + String value=""; + String valuelagi=null; + Cookie[] cookies = request.getCookies(); + if (cookies!=null){ + for (int i = 0; i < cookies.length; i++) { + Cookie c = cookies[i]; + name = c.getName(); + value = c.getValue(); + + if (name.equals("username")){ + valuelagi=value; + } + session.setAttribute(name, value); + } + } + + if(valuelagi==null){ + response.sendRedirect("registrasi.jsp"); + }else{ + if ( (String)session.getAttribute("email")==null){ + response.sendRedirect("getdatamember"); + }else{ + username = (String)session.getAttribute("username"); + password = (String)session.getAttribute("password"); + email= (String)session.getAttribute("email"); + namalengkap = (String)session.getAttribute("namalengkap"); + nohp= (String)session.getAttribute("nohp"); + provinsi= (String)session.getAttribute("provinsi"); + kotakabupaten= (String)session.getAttribute("kotakabupaten"); + alamat=(String)session.getAttribute("alamat"); + kodepos=(String)session.getAttribute("kodepos"); + jumlahtransaksi=(String)session.getAttribute("jumlahtransaksi"); + } + + } +%> + + + + + + + Profile + + + + +
+ + + + + + + + + + + + + + + + +
+

Your Profile

+ +
+ +
+ + +
+
+

Username:

+

+ +

+
+ +
+

Change Password :

+

+ + +

+
+ +
+

Confirm Password :

+

+ + +

+
+ +
+

Nama Lengkap :

+

+ + +

+
+ +
+

Email :

+

+ +

+
+ +
+

No HP :

+

+ + +

+
+ +
+

Provinsi:

+

+ +

+
+ + +
+

Kota/Kabupaten:

+

+ +

+
+ + +
+

Alamat:

+

+ +

+
+ + +
+

Kode Pos:

+

+ +

+
+ + jumlah transaksi <%out.print(jumlahtransaksi);%>
+ + +
+ +
+ +
+ +
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/src/header.jsp b/src/header.jsp new file mode 100644 index 0000000..a864944 --- /dev/null +++ b/src/header.jsp @@ -0,0 +1,153 @@ + + + +
+ + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/src/index.jsp b/src/index.jsp new file mode 100644 index 0000000..f103e00 --- /dev/null +++ b/src/index.jsp @@ -0,0 +1,184 @@ +<% + if (session.getAttribute("BestBuy1")==null){ + response.sendRedirect("getbestbuy"); + }else{ + + } + +%> + + + + + Home + + + + +
+ + + + + Best Buy Products!! + + +
+
+ +
+

+ Thank you for visiting our online shop ! +

+
+
+ + +
+



+ +
+
+
Aturan Belanja:
+
1. Pengguna yang ingin berbelanja harus memiliki akun terlebih dahulu, jika sudah, pilih login dan jika belum pilih registrasi +

2. Pengguna yang ingin berbelanja harus memasukkan informasi kartu kredit, jika tidak, transaksi tidak akan direalisasikan +
HAPPY SHOPPING! +
+
+ + +
+ + + + + + + \ No newline at end of file diff --git a/src/logout.jsp b/src/logout.jsp new file mode 100644 index 0000000..e4cb3a7 --- /dev/null +++ b/src/logout.jsp @@ -0,0 +1,11 @@ +<% + +session.invalidate(); +Cookie[] cookies = request.getCookies(); +if(cookies!=null) +for (int i = 0; i < cookies.length; i++) { + cookies[i].setMaxAge(0); +response.addCookie(cookies[i]); +} +response.sendRedirect("index.jsp"); +%> \ No newline at end of file diff --git a/src/popup.js b/src/popup.js new file mode 100644 index 0000000..d23ff26 --- /dev/null +++ b/src/popup.js @@ -0,0 +1,25 @@ + function login(showhide){ + if(showhide == "show"){ + document.getElementById('popupbox').style.visibility="visible"; + }else if(showhide == "hide"){ + document.getElementById('popupbox').style.visibility="hidden"; + } + } + + + function addbarang(showhide){ + if(showhide == "show"){ + document.getElementById('popupboxadd').style.visibility="visible"; + }else if(showhide == "hide"){ + document.getElementById('popupboxadd').style.visibility="hidden"; + } + } + + + function editbarang(showhide){ + if(showhide == "show"){ + document.getElementById('popupboxedit').style.visibility="visible"; + }else if(showhide == "hide"){ + document.getElementById('popupboxedit').style.visibility="hidden"; + } + } \ No newline at end of file diff --git a/src/registrasi.jsp b/src/registrasi.jsp new file mode 100644 index 0000000..d2a8505 --- /dev/null +++ b/src/registrasi.jsp @@ -0,0 +1,132 @@ +<% + String name=""; + String value=""; + String valuelagi=null; + Cookie[] cookies = request.getCookies(); + if (cookies!=null){ + for (int i = 0; i < cookies.length; i++) { + Cookie c = cookies[i]; + name = c.getName(); + value = c.getValue(); + + if (name.equals("username")){ + valuelagi=value; + } + session.setAttribute(name, value); + } + } + + if(valuelagi!=null){ + response.sendRedirect("index.jsp"); + } + +%> + + + + + + Registrasi + + + + +
+ + + + +
+

Registration

+ + +
+ +
+

Username :

+

+ + +

+
+ +
+

Password :

+

+ + +

+
+ +
+

Password(retype) :

+

+ + +

+
+ +
+

Nama Lengkap :

+

+ +

+
+ +
+

Email :

+

+ + +

+
+ +
+

Handphone :

+

+ + +

+
+ +
+

Provinsi :

+

+
+ +
+

Kota/Kabupaten :

+

+
+ +
+

Alamat :

+ +
+ + +
+

Kode Pos :

+

+
+ + + + +
+ +
+
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/src/res/css/grid.css b/src/res/css/grid.css new file mode 100644 index 0000000..4bca337 --- /dev/null +++ b/src/res/css/grid.css @@ -0,0 +1,50 @@ +/* + Sistem grid ini adalah hasil modifikasi dari: + http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/& + build-a-freshly-squeezed-responsive-grid-system/ + + Riandy R.N/13511014 + +*/ + +*, *:after, *:before { + margin: 0; + padding: 0; + /* Removes padding behaviour on widths */ + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +/* Attribute selector */ +[class*='kolom-'] { + float: left; + padding: 10px; +} + +/* Floats last ".kolom-" to the right */ +/*[class*='kolom-']:last-of-type { + padding-right: 10px; + float: right; +}*/ + +/* Clearfix */ +.frame:after { + content: ""; + display: table; + clear: both; +} + +/* Main Widths */ +.kolom-1 { width: 6.5%; } +.kolom-2 { width: 15%; } +.kolom-3 { width: 23.5%; } +.kolom-4 { width: 32%; } +.kolom-5 { width: 40.5%; } +.kolom-6 { width: 49%; } +.kolom-7 { width: 57.5%; } +.kolom-8 { width: 66%; } +.kolom-9 { width: 74.5%; } +.kolom-10 { width: 83%; } +.kolom-11 { width: 91.5%; } +.kolom-12 { width: 100%; } \ No newline at end of file diff --git a/src/res/css/style.css b/src/res/css/style.css new file mode 100644 index 0000000..4672fc0 --- /dev/null +++ b/src/res/css/style.css @@ -0,0 +1,601 @@ +@import url("grid.css"); +@import url(http://fonts.googleapis.com/css?family=Open+Sans); + +body { + background-color: #fff; + font-family: 'Open Sans', sans-serif; + text-align: center; +} + +.debug { + background-color: #000; +} + +.btn { + -moz-box-shadow:inset 0px 1px 0px 0px #cccccc; + -webkit-box-shadow:inset 0px 1px 0px 0px #ccccc; + box-shadow:inset 0px 1px 0px 0px #cccccc; + background-color:#cccccc; + -webkit-border-top-left-radius:5px; + -moz-border-radius-topleft:5px; + border-top-left-radius:5px; + -webkit-border-top-right-radius:5px; + -moz-border-radius-topright:5px; + border-top-right-radius:5px; + -webkit-border-bottom-right-radius:5px; + -moz-border-radius-bottomright:5px; + border-bottom-right-radius:5px; + -webkit-border-bottom-left-radius:5px; + -moz-border-radius-bottomleft:5px; + border-bottom-left-radius:5px; + text-indent:0px; + display:inline-block; + color:#B20000; + font-family:Arial; + font-size:13px; + font-weight:bolder; + font-style:normal; + height:40px; + line-height:40px; + width:152px; + text-decoration:none; + text-align:center; +}.btn:hover { + background-color:#000000; +}.btn:active { + position:relative; + top:1px; +} + +#user-control { + padding-bottom: 10px; +} + +#container { + width: 960px; + display: block; + margin: 0 auto; +} + +#user-panel { + background-color: #B20000; + margin-top:-10px; +} + +#user-text { + font-size: 0.93em; + color: #fff; + opacity: 0.9; +} + +#user-text { + font-size: 0.7em; +} + +#user-text > h3 { + font-size: 1.3em; +} + +#user { + border-bottom-style: solid; + border-width: 5px; + border-color: #000000; +} + +#search-bar { + padding: 15px 25px; +} + +.edit-logout > a:link, +.edit-logout > a:visited, +.btn-right:link, +.btn-right:visited, +.btn-left:link, +.btn-left:visited +{ + color: #fff; +} + +#search-box { + width: 200px; + height: 30px; + color: #cccccc; + font-size: 12px; + padding-left: 7px; +} + +#search-kategori { + width: 200px; + height: 30px; + color: #cccccc; + font-size: 12px; + padding-left: 0; + margin-left: -37px; + margin-top:3px; +} + + +#search-harga1 { + width: 85px; + height: 30px; + color: #cccccc; + font-size: 12px; + padding-left: 0; + margin-left: -37px; + margin-top:3px; +} + +#search-harga2 { + width: 85px; + height: 30px; + color: #cccccc; + font-size: 12px; + padding-left: 0; + margin-top:3px; +} + +#search-button { + background-image: url('../img/btn_src.png'); + background-color: #B20000; + width: 28px; + height: 28px; + border: none; + margin-left: 9px; +} + +#navbar { + font-size: 1.3em; + color: #868789; + margin-top: 20px; +} + +#navbar > ul { + list-style-type:none; + margin:0; + padding: 0; +} + +#navbar > ul > li { + display: inline; + padding: 0 15px; +} + +#navbar > ul > li > a:link, #navbar > ul > li > a:visited , .btn-right, .btn-left{ + color: #868789; + text-decoration: none; +} + +#slideshow { + position:relative; + margin: 25px 0; + background-color: #B20000; + margin-bottom: -70px; +} + +#slideshow > .item { + position: relative; + padding: 40px 0; +} + +.caption { + +} + +.caption > .text { + position: absolute; + left: 61px; + bottom: 45px; + right: 61px; + background-color: #333; + opacity: 0.8; + color: #fff; + height: 42px; + padding-top: 10px; + font-size: 14px; +} + +.btn-left, .btn-right { + position: absolute; + top: 200px; + font-size: 5em; + opacity: 0.8; +} + +.btn-left { + left: 20px; +} + +.btn-right { + right: 20px; +} + +#bbuy-text { + margin-top: 50px; + margin-left : 17%; +} + +#bbuy-a, #bbuy-b { + color: #B20000; +} + +#bbuy-a { + font-size: 36px; +} + +#bbuy-b { + font-size: 24px; +} + +.product { + color: #333; +} + +.product a:link, +.product a:visited { + color: #333; + text-decoration: none; +} + +.product .gambar { + border-style: solid; + border-color: #cccccc; + border-width: 2px; + padding: 20px 0; + height: 176px; + width: 186px; + +} +.gambar:hover{ + border-style: solid; + border-color: #cccccc; + border-width: 15px; + padding: 20px 0; + + +} +.gambarhome { + border-style: solid; + border-color: #cccccc; + border-width: 2px; + padding: 20px 0; + max-height: 176px; + min-width: 186px; + -webkit-animation: spin 0.5s linear 2s infinite alternate; + animation: spin 0.5s linear 2s infinite alternate; + + -webkit-transition-duration: 0.8s; + -moz-transition-duration: 0.8s; + -o-transition-duration: 0.8s; + transition-duration: 0.8s; + + -webkit-transition-property: -webkit-transform; + -moz-transition-property: -moz-transform; + -o-transition-property: -o-transform; + transition-property: transform; + overflow:hidden; + +} +.gambarhome:hover{ + + -webkit-transform:rotate(360deg); + -moz-transform:rotate(360deg); + -o-transform:rotate(360deg); + +} +@-webkit-keyframes spin { + 100% + { -webkit-transform: rotate(5deg); + } + +} +@keyframes spin { + 100% + { -webkit-transform: rotate(5deg); + } + +} + + + +.nama-produk { + font-size: 18px; +} + +.asal-produk { + font-size: 11px; +} + +.nama-produk-b, .harga, .buy-bar { + text-align: left; + padding-bottom: 10px; +} + +.nama-produk-b { + font-size: 24px; + color: #B20000; +} + +.nama-produk-b a:link, .nama-produk-b a:visited { + text-decoration: none; + color: #B20000; +} + +.harga { + font-size: 14px; +} + +#best-buy-btn { + position: center; + + + +} + + +#dagangan { + margin-top: 30px; +} + +.buy-box { + color: #cccccc; +} + +.buy-button { + position: relative; + background-color: transparent; + border: none; + background-image: url('../img/btn_cart.png'); + background-repeat: no-repeat; + width: 35px; + left: 8px; + top: 4px; +} + +#src-title { + padding: 20px; + font-size: 24px; + color: #868789; +} + +.src-param { + font-weight: bolder; +} + +#pagination { + font-size: 16px; + padding-bottom: 55px; +} + +#pagination a:link, #pagination a:visited { + color: #B20000; +} + +#pagination > ul { + list-style-type: none; + margin: 0; + padding: 0; +} + +#pagination > ul > li { + display: inline; + padding: 0 15px; +} + +#form-registrasi { + background-color: #B20000; + color: #fff; + text-align: left; +} + + +#formpetunjuk{ + background-color: #B20000; + color: #EBEBED; + padding: 30px; + font-family: helvetica; + font-style: normal; + font-weight: normal; + font-size: 16px; + font-variant: normal; + line-height: 22px; + border-radius: 12px; + +} + +#divpetunjuk { + width: 50px; + margin-left: 5px; + margin-right: auto; + margin-top: 63px; + text-align: left; + float: left; width: 27%; +} + +.judulbest { + background-color: #B20000; + color : #ffffff; + font-size : 20px + +} + +.ShoppingBag { + background-color: #B20000; + color: #fff; + text-align: left; + position : center; + margin : 50px 50px; +} + +#registration-title, #product-title { + font-size: 36px; +} + +#form-registrasi { + margin: 20px 0; + padding: 40px 50px; + margin-bottom: 40px; +} + +.form-field { + padding: 10px 0; + margin-bottom: 20px; +} + +.label { + padding: 5px 0; +} + +.field-box { + min-height: 35px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + border: none; + color: #333; +} + +.field-area { + height: 100px; + font-family: inherit; + margin-bottom: 10px; +} + +#btn-register { + display: block; + border: none; + text-align: center; + margin: 0 auto; + margin-top: 10px; + width: 250px; + height: 50px; + font-size: 24px; + font-weight: normal; +} + +#data-diri p { + margin: 2px 0; +} + +#data-diri { + padding: 10px 0; +} + +.bolder { + font-weight: bolder; +} + +#data-diri .teks { + margin-left: 17px; +} + +#btn-profile { + margin: 15px 0; + width: 70%; +} + +#table-shopping { + text-align: center; + border-color: #fff; + text-shadow: none; + border-style: solid; + position : relative; +} + +#total-harga { + text-align: right; + font-size: 1.1em; + font-weight: bolder; +} + +#btn-order { + margin-top: 10px; + float: right; +} + +#btn-order:after { + clear: both; + content: ''; +} + +#btn-register-cc { + width: 200px; +} + +#sort-bar { + padding-top: 25px; +} + +#sort-box { + background-color: #3AC0A8; + border: none; + color: #fff; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} + +.buy-text { + font-family: inherit; + margin: 10px 0; + color: #bebebe; +} + +.harga-detail { + font-size: 18px; + text-align: left; +} + +#gambar-detail { + margin-top: 15px; +} + + #popupbox{ + margin: 0; + margin-left: 42%; + margin-top: -10%; + padding-top: 10px; + width: 20%; + height: 150px; + position: absolute; + background: #B20000; + border: solid #000000 2px; + z-index: 9; + font-family: arial; + visibility: hidden; + } + + #popupboxadd{ + margin: 0; + text-align: left; + margin-left: 25%; + margin-top: 0%; + padding: 10px; + width: 20%; + height: 280px; + position: fixed; + top: 15em; + right: 35em; + background: #B20000; + border: solid #000000 2px; + z-index: 9; + font-family: arial; + visibility: hidden; + } + + #popupboxedit{ + margin: 0; + text-align: left; + margin-left: 25%; + margin-top: 0%; + padding: 10px; + width: 20%; + height: 250px; + position: fixed; + top: 15em; + right: 35em; + background: #B20000; + border: solid #000000 2px; + z-index: 9; + font-family: arial; + visibility: hidden; + } \ No newline at end of file diff --git a/src/res/img/Thumbs.db b/src/res/img/Thumbs.db new file mode 100644 index 0000000..6e7a228 Binary files /dev/null and b/src/res/img/Thumbs.db differ diff --git a/src/res/img/btn_cart.png b/src/res/img/btn_cart.png new file mode 100644 index 0000000..9b9f099 Binary files /dev/null and b/src/res/img/btn_cart.png differ diff --git a/src/res/img/btn_src.png b/src/res/img/btn_src.png new file mode 100644 index 0000000..e085ab9 Binary files /dev/null and b/src/res/img/btn_src.png differ diff --git a/src/res/img/logo.png b/src/res/img/logo.png new file mode 100644 index 0000000..e685c12 Binary files /dev/null and b/src/res/img/logo.png differ diff --git a/src/res/img/product/AnakMas.jpg b/src/res/img/product/AnakMas.jpg new file mode 100644 index 0000000..050c1c6 Binary files /dev/null and b/src/res/img/product/AnakMas.jpg differ diff --git a/src/res/img/product/BAKSOSOGOOD.jpg b/src/res/img/product/BAKSOSOGOOD.jpg new file mode 100644 index 0000000..65a6771 Binary files /dev/null and b/src/res/img/product/BAKSOSOGOOD.jpg differ diff --git a/src/res/img/product/Banquet.jpg b/src/res/img/product/Banquet.jpg new file mode 100644 index 0000000..a42abea Binary files /dev/null and b/src/res/img/product/Banquet.jpg differ diff --git a/src/res/img/product/BayamItali.jpg b/src/res/img/product/BayamItali.jpg new file mode 100644 index 0000000..c858758 Binary files /dev/null and b/src/res/img/product/BayamItali.jpg differ diff --git a/src/res/img/product/Bengbeng.jpg b/src/res/img/product/Bengbeng.jpg new file mode 100644 index 0000000..7f6c55f Binary files /dev/null and b/src/res/img/product/Bengbeng.jpg differ diff --git a/src/res/img/product/BerasA-KING.jpg b/src/res/img/product/BerasA-KING.jpg new file mode 100644 index 0000000..56888e5 Binary files /dev/null and b/src/res/img/product/BerasA-KING.jpg differ diff --git a/src/res/img/product/BerasCarrefour.jpg b/src/res/img/product/BerasCarrefour.jpg new file mode 100644 index 0000000..e389735 Binary files /dev/null and b/src/res/img/product/BerasCarrefour.jpg differ diff --git a/src/res/img/product/BerasHCSR04.jpg b/src/res/img/product/BerasHCSR04.jpg new file mode 100644 index 0000000..cefefaf Binary files /dev/null and b/src/res/img/product/BerasHCSR04.jpg differ diff --git a/src/res/img/product/BerasHitam.jpg b/src/res/img/product/BerasHitam.jpg new file mode 100644 index 0000000..ca45a33 Binary files /dev/null and b/src/res/img/product/BerasHitam.jpg differ diff --git a/src/res/img/product/BerasMYPASA.jpg b/src/res/img/product/BerasMYPASA.jpg new file mode 100644 index 0000000..a135c63 Binary files /dev/null and b/src/res/img/product/BerasMYPASA.jpg differ diff --git a/src/res/img/product/BerasMerah.jpg b/src/res/img/product/BerasMerah.jpg new file mode 100644 index 0000000..0a44bd4 Binary files /dev/null and b/src/res/img/product/BerasMerah.jpg differ diff --git a/src/res/img/product/BerasOrganik.jpg b/src/res/img/product/BerasOrganik.jpg new file mode 100644 index 0000000..9a90905 Binary files /dev/null and b/src/res/img/product/BerasOrganik.jpg differ diff --git a/src/res/img/product/BerasRaskin.jpg b/src/res/img/product/BerasRaskin.jpg new file mode 100644 index 0000000..62d5fae Binary files /dev/null and b/src/res/img/product/BerasRaskin.jpg differ diff --git a/src/res/img/product/BerasSuper.jpg b/src/res/img/product/BerasSuper.jpg new file mode 100644 index 0000000..7066c29 Binary files /dev/null and b/src/res/img/product/BerasSuper.jpg differ diff --git a/src/res/img/product/BerasTajMahal.jpg b/src/res/img/product/BerasTajMahal.jpg new file mode 100644 index 0000000..ea4d269 Binary files /dev/null and b/src/res/img/product/BerasTajMahal.jpg differ diff --git a/src/res/img/product/Brokoli.jpg b/src/res/img/product/Brokoli.jpg new file mode 100644 index 0000000..e3ddc18 Binary files /dev/null and b/src/res/img/product/Brokoli.jpg differ diff --git a/src/res/img/product/ChickenNugget.jpg b/src/res/img/product/ChickenNugget.jpg new file mode 100644 index 0000000..f8bdd9a Binary files /dev/null and b/src/res/img/product/ChickenNugget.jpg differ diff --git a/src/res/img/product/DagingAyam.jpg b/src/res/img/product/DagingAyam.jpg new file mode 100644 index 0000000..dd81d00 Binary files /dev/null and b/src/res/img/product/DagingAyam.jpg differ diff --git a/src/res/img/product/DagingBebek.jpg b/src/res/img/product/DagingBebek.jpg new file mode 100644 index 0000000..6863d14 Binary files /dev/null and b/src/res/img/product/DagingBebek.jpg differ diff --git a/src/res/img/product/DagingDomba.jpg b/src/res/img/product/DagingDomba.jpg new file mode 100644 index 0000000..2f8ddf8 Binary files /dev/null and b/src/res/img/product/DagingDomba.jpg differ diff --git a/src/res/img/product/DagingHiu.jpg b/src/res/img/product/DagingHiu.jpg new file mode 100644 index 0000000..e3a442b Binary files /dev/null and b/src/res/img/product/DagingHiu.jpg differ diff --git a/src/res/img/product/DagingKepiting.jpg b/src/res/img/product/DagingKepiting.jpg new file mode 100644 index 0000000..e1f9596 Binary files /dev/null and b/src/res/img/product/DagingKepiting.jpg differ diff --git a/src/res/img/product/DagingKuda.jpg b/src/res/img/product/DagingKuda.jpg new file mode 100644 index 0000000..ab9e66c Binary files /dev/null and b/src/res/img/product/DagingKuda.jpg differ diff --git a/src/res/img/product/DagingRusa.jpg b/src/res/img/product/DagingRusa.jpg new file mode 100644 index 0000000..3c3d232 Binary files /dev/null and b/src/res/img/product/DagingRusa.jpg differ diff --git a/src/res/img/product/DagingSapi.jpg b/src/res/img/product/DagingSapi.jpg new file mode 100644 index 0000000..a27c782 Binary files /dev/null and b/src/res/img/product/DagingSapi.jpg differ diff --git a/src/res/img/product/DagingUnta.jpg b/src/res/img/product/DagingUnta.jpg new file mode 100644 index 0000000..bb675c8 Binary files /dev/null and b/src/res/img/product/DagingUnta.jpg differ diff --git a/src/res/img/product/DagingYak.jpg b/src/res/img/product/DagingYak.jpg new file mode 100644 index 0000000..725dfc5 Binary files /dev/null and b/src/res/img/product/DagingYak.jpg differ diff --git a/src/res/img/product/DaunSingkong.jpg b/src/res/img/product/DaunSingkong.jpg new file mode 100644 index 0000000..b34377f Binary files /dev/null and b/src/res/img/product/DaunSingkong.jpg differ diff --git a/src/res/img/product/FIESTANIGGA.jpg b/src/res/img/product/FIESTANIGGA.jpg new file mode 100644 index 0000000..22e2724 Binary files /dev/null and b/src/res/img/product/FIESTANIGGA.jpg differ diff --git a/src/res/img/product/Findus.jpg b/src/res/img/product/Findus.jpg new file mode 100644 index 0000000..f0a23ae Binary files /dev/null and b/src/res/img/product/Findus.jpg differ diff --git a/src/res/img/product/Gaga.jpg b/src/res/img/product/Gaga.jpg new file mode 100644 index 0000000..05c9950 Binary files /dev/null and b/src/res/img/product/Gaga.jpg differ diff --git a/src/res/img/product/IceCream.jpg b/src/res/img/product/IceCream.jpg new file mode 100644 index 0000000..2a5acb7 Binary files /dev/null and b/src/res/img/product/IceCream.jpg differ diff --git a/src/res/img/product/KacangGaruda.jpg b/src/res/img/product/KacangGaruda.jpg new file mode 100644 index 0000000..5303aaa Binary files /dev/null and b/src/res/img/product/KacangGaruda.jpg differ diff --git a/src/res/img/product/Kangkung.jpg b/src/res/img/product/Kangkung.jpg new file mode 100644 index 0000000..9d76198 Binary files /dev/null and b/src/res/img/product/Kangkung.jpg differ diff --git a/src/res/img/product/KitKat.jpg b/src/res/img/product/KitKat.jpg new file mode 100644 index 0000000..81ff558 Binary files /dev/null and b/src/res/img/product/KitKat.jpg differ diff --git a/src/res/img/product/Kol.jpg b/src/res/img/product/Kol.jpg new file mode 100644 index 0000000..5605324 Binary files /dev/null and b/src/res/img/product/Kol.jpg differ diff --git a/src/res/img/product/LeoKripikKentang.jpg b/src/res/img/product/LeoKripikKentang.jpg new file mode 100644 index 0000000..4765644 Binary files /dev/null and b/src/res/img/product/LeoKripikKentang.jpg differ diff --git a/src/res/img/product/Lolipop.jpg b/src/res/img/product/Lolipop.jpg new file mode 100644 index 0000000..d805f9c Binary files /dev/null and b/src/res/img/product/Lolipop.jpg differ diff --git a/src/res/img/product/MiGemez.jpg b/src/res/img/product/MiGemez.jpg new file mode 100644 index 0000000..0e77bfa Binary files /dev/null and b/src/res/img/product/MiGemez.jpg differ diff --git a/src/res/img/product/PetaiCHINA.jpg b/src/res/img/product/PetaiCHINA.jpg new file mode 100644 index 0000000..240e9d4 Binary files /dev/null and b/src/res/img/product/PetaiCHINA.jpg differ diff --git a/src/res/img/product/SOZZZZZZIS.jpg b/src/res/img/product/SOZZZZZZIS.jpg new file mode 100644 index 0000000..f1e42ca Binary files /dev/null and b/src/res/img/product/SOZZZZZZIS.jpg differ diff --git a/src/res/img/product/Sawi.jpg b/src/res/img/product/Sawi.jpg new file mode 100644 index 0000000..27e7edf Binary files /dev/null and b/src/res/img/product/Sawi.jpg differ diff --git a/src/res/img/product/SeledriHongkong.jpg b/src/res/img/product/SeledriHongkong.jpg new file mode 100644 index 0000000..197b77f Binary files /dev/null and b/src/res/img/product/SeledriHongkong.jpg differ diff --git a/src/res/img/product/SilverQueen.jpg b/src/res/img/product/SilverQueen.jpg new file mode 100644 index 0000000..ae34a2e Binary files /dev/null and b/src/res/img/product/SilverQueen.jpg differ diff --git a/src/res/img/product/SimplyFood.jpg b/src/res/img/product/SimplyFood.jpg new file mode 100644 index 0000000..703e310 Binary files /dev/null and b/src/res/img/product/SimplyFood.jpg differ diff --git a/src/res/img/product/SiomayMantap.jpg b/src/res/img/product/SiomayMantap.jpg new file mode 100644 index 0000000..7f29293 Binary files /dev/null and b/src/res/img/product/SiomayMantap.jpg differ diff --git a/src/res/img/product/Stouffers.jpg b/src/res/img/product/Stouffers.jpg new file mode 100644 index 0000000..6500fea Binary files /dev/null and b/src/res/img/product/Stouffers.jpg differ diff --git a/src/res/img/product/Thumbs.db b/src/res/img/product/Thumbs.db new file mode 100644 index 0000000..7742cec Binary files /dev/null and b/src/res/img/product/Thumbs.db differ diff --git a/src/res/img/product/TimunAustralia.jpg b/src/res/img/product/TimunAustralia.jpg new file mode 100644 index 0000000..b2061db Binary files /dev/null and b/src/res/img/product/TimunAustralia.jpg differ diff --git a/src/res/img/product/ToKaeNoi.jpg b/src/res/img/product/ToKaeNoi.jpg new file mode 100644 index 0000000..c270842 Binary files /dev/null and b/src/res/img/product/ToKaeNoi.jpg differ diff --git a/src/res/img/product/Wortel.jpg b/src/res/img/product/Wortel.jpg new file mode 100644 index 0000000..038bc9b Binary files /dev/null and b/src/res/img/product/Wortel.jpg differ diff --git a/src/res/img/slideshow/gulali_world.png b/src/res/img/slideshow/gulali_world.png new file mode 100644 index 0000000..6187308 Binary files /dev/null and b/src/res/img/slideshow/gulali_world.png differ diff --git a/src/res/img/userpict_b.png b/src/res/img/userpict_b.png new file mode 100644 index 0000000..895378d Binary files /dev/null and b/src/res/img/userpict_b.png differ diff --git a/src/res/img/userpict_h.png b/src/res/img/userpict_h.png new file mode 100644 index 0000000..785545c Binary files /dev/null and b/src/res/img/userpict_h.png differ diff --git a/src/res/js/common.js b/src/res/js/common.js new file mode 100644 index 0000000..f18149c --- /dev/null +++ b/src/res/js/common.js @@ -0,0 +1,27 @@ +function checkclear(what){ + if(!what._haschanged){ + what.value='' + }; + what._haschanged=true; +} + +function checkempty(what, msg_if_empty) { + if(what.value=='') { + what.value= msg_if_empty; + what._haschanged=false; + }; +} + +function validateForm(form_name, properties, msg_if_blank) +{ +var x=document.forms[form_name][properties].value; +var kat = document.getElementById("search-kategori").value; +var har1 = document.getElementById("search-harga1").value; +var har2 = document.getElementById("search-harga2").value; + +if ((x==null || x=="" || x==msg_if_blank)&&(kat=="%")&&(har1=="-1" || har2=="999999999")) + { + alert("Harap diisi, input tidak valid!"); + return false; + } +} \ No newline at end of file diff --git a/src/scriptmember.js b/src/scriptmember.js new file mode 100644 index 0000000..69fd432 --- /dev/null +++ b/src/scriptmember.js @@ -0,0 +1,155 @@ + + function cekNamaDuaKata() { + var pass = document.getElementById("namalengkap").value; + for (var i = 0;i=0 && i+17 && pass1!=user && pass1!=em) { + document.getElementById("validasipassword").value="valid"; + return true; + } + else { + + document.getElementById("validasipassword").value="tidak valid"; + return false; + } + } + + + + function ceknohp() { + var pass = document.getElementById("nohp").value; + var reg = /[0-9]+[0-9]*/ + document.getElementById("validasinohp").value="valid"; + if (reg.test(pass)) { + document.getElementById("validasinohp").value="valid"; + return true; + } + else { + document.getElementById("validasinohp").value="tidak valid"; + return false; + } + } + + + + function cekfilledAll() + { + var elem = document.getElementById("profile").elements; + var cansubmit = true; + + for (var i = 0; i < elem.length; i++) { + if (elem[i].value.length == 0) cansubmit = false; + } + if (cansubmit){ + return true; + }else{ + return false; + } + + } + + + + function cekvalidAll() + { + if (cekfilledAll() && cekNamaDuaKata() && ceknohp() && cekPassword() && cekCPassword()){ + document.getElementById("submitbutton").removeAttribute("disabled"); + + } + else{ + document.getElementById("submitbutton").setAttribute("disabled"); + } + + } + + +function sleep(milliseconds) { + var start = new Date().getTime(); + for (var i = 0; i < 1e7; i++) { + if ((new Date().getTime() - start) > milliseconds){ + break; + } + } +} + + +function cekChangeData(){ + + var username = document.getElementById("eusername").value; + var password = document.getElementById("epassword").value; + + var email = document.getElementById("email").value; + var namalengkap= document.getElementById("namalengkap").value; + + var nohp= document.getElementById("nohp").value; + + + var provinsi = document.getElementById("provinsi").value; + + var kotakabupaten = document.getElementById("kotakabupaten").value; + + var alamat = document.getElementById("alamat").value; + var kodepos = document.getElementById("kodepos").value; + + + var iusername = document.getElementById("iusername").value; + var ipassword = document.getElementById("ipassword").value; + var iemail = document.getElementById("iemail").value; + var inamalengkap= document.getElementById("inamalengkap").value; + var inohp= document.getElementById("inohp").value; + + + var iprovinsi = document.getElementById("iprovinsi").value; + var ikotakabupaten = document.getElementById("ikotakabupaten").value; + + var ialamat = document.getElementById("ialamat").value; + + var ikodepos = document.getElementById("ikodepos").value; + + + if (iusername==username && ipassword==password && iemail==email && inamalengkap==namalengkap && inohp==nohp && iprovinsi==provinsi && ikotakabupaten==kotakabupaten && ialamat==alamat && ikodepos==kodepos){ + alert("Tidak ada perubahan pada data"); + return false; + + }else{ + alert("Sukses\n"+username); + sleep(1); + return true; + + } + +} + diff --git a/src/scriptregister.js b/src/scriptregister.js new file mode 100644 index 0000000..4d60ed5 --- /dev/null +++ b/src/scriptregister.js @@ -0,0 +1,130 @@ + + function cekNamaDuaKata() { + var pass = document.getElementById("namalengkap").value; + for (var i = 0;i=0 && i+17 && pass1!=user && pass1!=em) { + document.getElementById("validasipassword").value="valid"; + return true; + } + else { + + document.getElementById("validasipassword").value="tidak valid"; + return false; + } + } + + + + function ceknohp() { + var pass = document.getElementById("nohp").value; + var reg = /[0-9]+[0-9]*/ + document.getElementById("validasinohp").value="valid"; + if (reg.test(pass)) { + document.getElementById("validasinohp").value="valid"; + return true; + } + else { + document.getElementById("validasinohp").value="tidak valid"; + return false; + } + } + + + + function cekfilledAll() + { + var elem = document.getElementById("register").elements; + var cansubmit = true; + + for (var i = 0; i < elem.length; i++) { + if (elem[i].value.length == 0) cansubmit = false; + } + if (cansubmit){ + return true; + }else{ + return false; + } + + } + + function cekvalidAll() + { + if (cekfilledAll() && cekusername() && cekNamaDuaKata() && cekEmail() && ceknohp() && cekPassword() && cekCPassword()){ + document.getElementById("submitbutton").removeAttribute("disabled"); + + } + else{ + document.getElementById("submitbutton").setAttribute("disabled"); + } + + } + + + function cekusername() + { + var pass = document.getElementById("rpassword").value; + var user = document.getElementById("rusername").value; + + if (user.length>4 && pass!=user && AJAXRegister("rusername") ){ + document.getElementById("validasiusername").value="valid"; + return true; + } + else{ + document.getElementById("validasiusername").value="tidak valid"; + return false; + } + + } + + function cekEmail() + { + var reg = /^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$/; + var elem = document.getElementById("email").value; + var pass = document.getElementById("rpassword").value; + if (reg.test(elem) && pass!=elem && AJAXRegister("email")){ + document.getElementById("validasiemail").value="valid"; + return true; + } + else{ + document.getElementById("validasiemail").value="tidak valid"; + return false; + } + + + } + \ No newline at end of file diff --git a/src/scriptregistercreditcard.js b/src/scriptregistercreditcard.js new file mode 100644 index 0000000..0cc38f7 --- /dev/null +++ b/src/scriptregistercreditcard.js @@ -0,0 +1,70 @@ + +function ceknumber(){ + if (AJAXRegister("cardnumber")){ + + document.getElementById("validasicardnumber").value="valid"; + return true; + }else{ + document.getElementById("validasicardnumber").value="tidak valid"; + return false; + } +} + + + +function ceknamecard(){ + if (AJAXRegister("namecard")){ + document.getElementById("validasinamecard").value="valid"; + return true; + }else{ + document.getElementById("validasinamecard").value="tidak valid"; + return false; + } +} + + +function cekexpiredate(){ + + if (AJAXRegister("expiredate")){ + document.getElementById("validasiexpiredate").value="valid"; + return true; + + }else{ + document.getElementById("validasiexpiredate").value="tidak valid"; + return false; + } + +} + + +function cekvalid(){ + + if (cekfilledAll() && ceknumber() && ceknamecard() && cekexpiredate()){ + alert("sukses"); + return true; + }else{ + alert("pastikan data valid"); + return false; + } + + + +} + + +function cekfilledAll() +{ + var elem = document.getElementById("registercreditcard").elements; + var cansubmit = true; + + for (var i = 0; i < elem.length; i++) { + if (elem[i].value.length == 0) cansubmit = false; + } + if (cansubmit){ + + return true; + }else{ + return false; + } + +} \ No newline at end of file diff --git a/src/search.jsp b/src/search.jsp new file mode 100644 index 0000000..5d395b8 --- /dev/null +++ b/src/search.jsp @@ -0,0 +1,89 @@ +<% + int jumlahsearch = 0; + if (session.getAttribute("jumlahsearch")!=null){ + + }else{ + response.sendRedirect("getsearch"); + } + + +%> + + + + + Search + + + + +
+ + + + +

<% out.print(session.getAttribute("jumlahsearch"));%> Result(s)

+ + + + +
+ + +
+ + <%String str =""; + int test = (Integer)session.getAttribute("jumlahsearch"); + if (test>Integer.parseInt(request.getParameter("l"))){ + test = Integer.parseInt(request.getParameter("l")); + } + for (int i =Integer.parseInt(request.getParameter("f"));i<=test;i++){ %> +
+
+
+ .jpg" alt=""/> +
+
+

"><%str =(String)session.getAttribute("snama"+i);out.print(str);%>

+

Harga: <% int intr =(Integer)session.getAttribute("sharga"+i);out.print(intr);%> /kg

+
+
+
+ <%}%> +
+ +
+ + + +
+ + + + + + \ No newline at end of file