diff --git a/addItem.jsp b/addItem.jsp new file mode 100644 index 0000000..9286e5b --- /dev/null +++ b/addItem.jsp @@ -0,0 +1,41 @@ +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<% + Connection con = null; + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + String query = "SELECT jumlah FROM cart WHERE username=? AND namabarang=?"; + PreparedStatement st = con.prepareStatement(query); + st.setString(1, request.getParameter("username")); + st.setString(2, request.getParameter("namabarang")); + + ResultSet rs = st.executeQuery(); + if (rs.next()) { + query = "UPDATE cart SET jumlah=? WHERE username=? AND namabarang=?"; + PreparedStatement st2 = con.prepareStatement(query); + st2.setInt(1, Integer.parseInt(request.getParameter("jumlahBarang")) + rs.getInt(1)); + st2.setString(2, request.getParameter("username")); + st2.setString(3, request.getParameter("namabarang")); + + st2.executeUpdate(); + st2.clearParameters(); + out.println(""); + } else { + query = "INSERT INTO cart(namabarang, jumlah, keterangan, username) VALUES(?, ?, '', ?)"; + PreparedStatement st2 = con.prepareStatement(query); + st2.setString(1, request.getParameter("namabarang")); + st2.setInt(2, Integer.parseInt(request.getParameter("jumlahBarang"))); + st2.setString(3, request.getParameter("username")); + + st2.executeUpdate(); + st2.clearParameters(); + out.println(""); + } + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println(e.toString()); }; +%> \ No newline at end of file diff --git a/ajaxLoader.js b/ajaxLoader.js new file mode 100644 index 0000000..58c6265 --- /dev/null +++ b/ajaxLoader.js @@ -0,0 +1,34 @@ +var xmlhttp; +function httpRequest() { +if (window.XMLHttpRequest) + {// code for IE7+, Firefox, Chrome, Opera, Safari + xmlhttp=new XMLHttpRequest(); + } +else + {// code for IE6, IE5 + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); + } +} + +function loadXMLDoc(url,cfunc) +{ +httpRequest(); +xmlhttp.onreadystatechange=cfunc; +xmlhttp.open("GET",url,true); +xmlhttp.send(); +} + +function postForm(url, cfunc, form) { // w/o button + httpRequest(); + xmlhttp.onreadystatechange=cfunc; + xmlhttp.open("POST", url, true); + xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); + var formdata = ""; + for (var i=0;i +<% + Connection con = null; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + PreparedStatement st; + + st = con.prepareStatement("SELECT namabarang FROM cart"); + + ResultSet rs; + rs = st.executeQuery(); + + if (rs.next()) + response.getWriter().print(rs.getString(1)); + else response.getWriter().print(0); + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println("Unable to connect to database."); }; + +%> \ No newline at end of file diff --git a/browse.css b/browse.css new file mode 100644 index 0000000..b2bc80c --- /dev/null +++ b/browse.css @@ -0,0 +1,42 @@ +.itemView{ + display:block; + float:left; + width:390px; + height:180px; + margin:0; +} + +.itemDetail{ + display:block; + position:relative; + float:left; + top:0; + left:10px; + height:160px; + width:220px; +} + +.itemImage{ + display:block; + float:left; + position:relative; + width:160px; + height:160px; + background:#333333; +} + +.browseOption{ + display:block; + width:100%; + height: 30px; + float:left; +} + +#quantity{ + width:40px; + right:20px; +} + +.pagination{ + color: #47ca86; +} \ No newline at end of file diff --git a/browse.jsp b/browse.jsp new file mode 100644 index 0000000..3d38296 --- /dev/null +++ b/browse.jsp @@ -0,0 +1,132 @@ +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<% + Connection con = null; + String[] data = new String[8]; + String kategori = request.getParameter("kategori"); + String keyword = request.getParameter("keyword"); + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + PreparedStatement st; + String key= request.getParameter("keyword"); + String query = "SELECT * , (case when kategori like '%"+key+"%' then 1 else 0 end) + (case when nama like '%"+key+"%' then 1 else 0 end) + (case when keterangan like '%"+key+"%' then 1 else 0 end) as priority from barang where (kategori like '%"+key+"%' or nama like '%"+key+"%' or keterangan like '%"+key+"%' or harga like '%"+key+"%')"; + + if (!request.getParameter("kategori").equals("default")) { + query += " and kategori='" + request.getParameter("kategori")+"'"; + } + query += " order by "+request.getParameter("sortBy")+" DESC"; + + /* + if (!request.getParameter("kategori").equals("default")) { + query += " and kategori="+request.getParameter("kategori"); + } + query += "order by "+request.getParameter("sortBy")+" desc";*/ + + st = con.prepareStatement(query); + + ResultSet rs; + rs = st.executeQuery(); +%> + + + + + + + + + + + +
+ +
+
+

+ sort by : + +

+
+ +
+ <% + int temp = 0; + int currentIndex = Integer.parseInt(request.getParameter("currentPage")); + while (rs.next()) { + if (temp >= (currentIndex*10 - 10) && (temp < (currentIndex*10))) { + String s = "
"; + s+= ""; + s+= "
"; + s+= "

"+rs.getString(1)+"


"; + s+= "

harga @ Rp."+rs.getString(3)+"
"; + s+= "jumlah pembelian:
"; + s+= "

"; + s+= ""; + s+= ""; + s+= "
"; + s+= "
"; + out.println(s); + } + temp++; + } + %> +
+ +
+ + +
+
+ + + + +<% + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println(e.toString()); }; +%> + \ No newline at end of file diff --git a/checkBarang.jsp b/checkBarang.jsp new file mode 100644 index 0000000..dd2a622 --- /dev/null +++ b/checkBarang.jsp @@ -0,0 +1,35 @@ +<%-- + Document : checkBarang + Created on : Nov 27, 2013, 5:10:11 PM + Author : Administrator +--%> + +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<% + Connection con = null; + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/test","root",""); + + String namab = request.getParameter("nb"); + + PreparedStatement st; + + st = con.prepareStatement("SELECT nama_barang FROM Barang WHERE nama_barang=?"); + st.setString(1, namab); + + ResultSet rs; + rs = st.executeQuery(); + + if(rs.next()) { + response.getWriter().print(rs.getString(1) + " sudah terpakai"); + } else response.getWriter().print(1); + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println("Unable to connect to database."); }; + +%> \ No newline at end of file diff --git a/checkEmail.jsp b/checkEmail.jsp new file mode 100644 index 0000000..8e6cc9d --- /dev/null +++ b/checkEmail.jsp @@ -0,0 +1,30 @@ +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<% + Connection con = null; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + String email = request.getParameter("e"); + + PreparedStatement st; + + st = con.prepareStatement("SELECT email FROM user WHERE email=?"); + st.setString(1, email); + + ResultSet rs; + rs = st.executeQuery(); + + if(rs.next()) { + response.getWriter().print(rs.getString(1) + " sudah terpakai"); + } else response.getWriter().print(1); + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println("Unable to connect to database."); }; + +%> \ No newline at end of file diff --git a/checkUsername.jsp b/checkUsername.jsp new file mode 100644 index 0000000..aceb418 --- /dev/null +++ b/checkUsername.jsp @@ -0,0 +1,30 @@ +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<% + Connection con = null; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + String usr = request.getParameter("u"); + + PreparedStatement st; + + st = con.prepareStatement("SELECT username FROM user WHERE username=?"); + st.setString(1, usr); + + ResultSet rs; + rs = st.executeQuery(); + + if(rs.next()) { + response.getWriter().print(rs.getString(1) + " sudah terpakai"); + } else response.getWriter().print(1); + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println("Unable to connect to database."); }; + +%> \ No newline at end of file diff --git a/completeRegistration.jsp b/completeRegistration.jsp new file mode 100644 index 0000000..ba6e7e4 --- /dev/null +++ b/completeRegistration.jsp @@ -0,0 +1,36 @@ +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> + +<% + Connection con = null; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + PreparedStatement st; + String query = "INSERT INTO user(username, password, fullname, alamat, provinsi, kota, kodepos, nohp, tipe, transaksi, email) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + + st = con.prepareStatement(query); + st.setString(1, request.getParameter("un")); + st.setString(2, request.getParameter("pass")); + st.setString(3, request.getParameter("nl")); + st.setString(4, request.getParameter("nh")); + st.setString(5, request.getParameter("al")); + st.setString(6, request.getParameter("prov")); + st.setString(7, request.getParameter("kab")); + st.setString(8, request.getParameter("kp")); + st.setString(9, "pembeli"); + st.setInt(10, 0); + st.setString(11, request.getParameter("ema")); + + response.getWriter().print(st); + st.executeUpdate(); + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println(e.toString()); }; + +%> \ No newline at end of file diff --git a/completeTambahBarang.jsp b/completeTambahBarang.jsp new file mode 100644 index 0000000..ca5e77c --- /dev/null +++ b/completeTambahBarang.jsp @@ -0,0 +1,36 @@ +<%-- + Document : completeTambahBarang + Created on : Nov 27, 2013, 5:16:39 PM + Author : Administrator +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<%@include file="dbconfig.jsp"%> +<% + Connection con = null; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/test","root",""); + + PreparedStatement st; + String query = "INSERT INTO Barang(nama_barang, kategori_barang, harga_barang, stok_barang) VALUES (?, ?, ?, ?)"; + + st = con.prepareStatement(query); + st.setString(1, request.getParameter("nb")); + st.setString(2, request.getParameter("kb")); + st.setString(3, request.getParameter("hb")); + st.setString(4, request.getParameter("sb")); + + response.getWriter().print(st); + st.executeUpdate(); + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println(e.toString()); }; + +%> \ No newline at end of file diff --git a/dbconfig.jsp b/dbconfig.jsp new file mode 100644 index 0000000..df70e27 --- /dev/null +++ b/dbconfig.jsp @@ -0,0 +1,42 @@ +<%-- + Document : dbconfig + Created on : Nov 27, 2013, 7:44:48 PM + Author : Administrator +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + +OpenNMS Asset Management:Node + + +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> + + + + + + + + + + + + + + + + + + + + +


+ + +
+
+ + \ No newline at end of file diff --git a/detail.css b/detail.css new file mode 100644 index 0000000..678c1c7 --- /dev/null +++ b/detail.css @@ -0,0 +1,41 @@ +.division{ + display:inline-block; + width:100%; +} + +#textPermintaan{ + text-align:left; +} + +#description{ + text-align:left; + text-justify: inter-word; + display:block; + position:relative; + float:left; + left:20px; + width:500px; + text-indent:50px; +} + +#request{ + text-align:left; + display:block; + position:relative; + float:left; + height:160px; + width:300px; +} + +#statistic{ + text-align:left; + display:block; + position:relative; + float:left; + left:20px; + width:400px; +} + +#quantity{ + width:40px; +} \ No newline at end of file diff --git a/detail.jsp b/detail.jsp new file mode 100644 index 0000000..7594c11 --- /dev/null +++ b/detail.jsp @@ -0,0 +1,67 @@ +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<% + Connection con = null; + String[] data = new String[8]; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + PreparedStatement st; + String query = "SELECT * FROM barang WHERE nama=?"; + st = con.prepareStatement(query); + st.setString(1, request.getParameter("nama")); + + ResultSet rs; + rs = st.executeQuery(); + + if (rs.next()) { + + +%> + + + + + + + + + + + + +
+
+
+ +
+

<%= rs.getString(1)%>

+

<%= rs.getString(2)%>

+
+
+
+

permintaan khusus

+ +
+

harga: Rp.<%= rs.getString(3)%>
+ jumlah pembelian
+

+ +
+
+
+ + +<% } + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println(e.toString()); }; +%> + \ No newline at end of file diff --git a/editProfile.jsp b/editProfile.jsp new file mode 100644 index 0000000..a75fbd2 --- /dev/null +++ b/editProfile.jsp @@ -0,0 +1,31 @@ +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<% + Connection con = null; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + PreparedStatement st; + String query = "UPDATE user SET fullname=?, password=?, alamat=?, provinsi=?, kota=?, kodepos=?, nohp=?, email=? WHERE username=?"; + st = con.prepareStatement(query); + st.setString(1, request.getParameter("nl")); + st.setString(2, request.getParameter("pass")); + st.setString(3, request.getParameter("al")); + st.setString(4, request.getParameter("prov")); + st.setString(5, request.getParameter("kab")); + st.setString(6, request.getParameter("kp")); + st.setString(7, request.getParameter("nh")); + st.setString(8, request.getParameter("ema")); + st.setString(9, request.getParameter("username")); + out.println(st); + st.executeUpdate(); + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println(e.toString()); }; + +%> \ No newline at end of file diff --git a/header.js b/header.js new file mode 100644 index 0000000..dd28a06 --- /dev/null +++ b/header.js @@ -0,0 +1,156 @@ +var IsLogin = false; +var currUsername; +var LoginClicked = false; +var NamaDepan = "Yanuar"; +var KategoriBarang = new Array(); +KategoriBarang[0] = "makanan"; +KategoriBarang[1] = "aksesoris"; +KategoriBarang[2] = "pakaian"; +KategoriBarang[3] = "furnitur"; +KategoriBarang[4] = "mainan"; +var activeUser = ""; + +function IsLogin(){ + currUsername=getCookie("username"); + if (currUsername!=null && currUsername!="") { + return true; + } else { + return false; + } +} + +function getUsername() { + return localStorage.getItem('activeUser'); +} + +function drawHeaderContent(){ + document.getElementById('header').innerHTML=""; + document.getElementById('header').innerHTML+=" "; + document.getElementById('header').innerHTML+="
"; + document.getElementById('searchform').innerHTML+=""; + document.getElementById('searchform').innerHTML+="
"; + document.getElementById('header').innerHTML+=""; + + + //var activeUser = ""; + //loadXMLDoc( + // "isLogin.php", + // function() { + // if (xmlhttp.readyState==4) { + // activeUser = xmlhttp.responseText; + // alert(activeUser); + // + // if (activeUser != "") { + // document.getElementById('header').innerHTML+=""; + // document.getElementById('header').innerHTML+=""; + // } else { + // document.getElementById('header').innerHTML+=""; + // document.getElementById('header').innerHTML+=""; + // if (LoginClicked){ + // drawPopupLogin(); + // } + // } + // } + if (localStorage.getItem('activeUser') != "") { + document.getElementById('header').innerHTML+=""; + document.getElementById('header').innerHTML+=""; + } else { + document.getElementById('header').innerHTML+=""; + document.getElementById('header').innerHTML+=""; + if (LoginClicked){ + drawPopupLogin(); + } + } +} + +function triggerPopupLogin(){ + LoginClicked =!LoginClicked; + drawHeaderContent(); +} + +function drawPopupLogin(){ + document.getElementById('header').innerHTML+="
"; + document.getElementById('popupLoginContent').innerHTML+="username
"; + document.getElementById('popupLoginForm').innerHTML+="
"; + document.getElementById('popupLoginForm').innerHTML+="password
"; + document.getElementById('popupLoginForm').innerHTML+="

"; + document.getElementById('popupLoginForm').innerHTML+=" "; + document.getElementById('popupLoginForm').innerHTML+="
+<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<% + Connection con = null; + String index = request.getParameter("kategori"); + int currentIndex = Integer.parseInt(index); + String[] kategori = new String[5]; + kategori[0] = "makanan"; + kategori[1] = "aksesoris"; + kategori[2] = "pakaian"; + kategori[3] = "furnitur"; + kategori[4] = "mainan"; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + ResultSet[] sets = new ResultSet[5]; + + for (int i = 0; i < 5; i++) { + PreparedStatement st; + String query = "SELECT nama FROM barang WHERE kategori=? ORDER BY popularitas"; + + st = con.prepareStatement(query); + st.setString(1, kategori[i]); + + sets[i] = st.executeQuery(); + st.clearParameters(); + } + + int i = 0; +%> + + + + + + + + +
+ +
+

<%= kategori[currentIndex]%>

+ <% + while (sets[currentIndex].next() && i < 3) { + out.println(""); + i++; + } + %> +
+ + + +
+

Mekanisme

+ +
+
+ + + + +<% + con.close(); + } catch (Exception e) {out.println(e.toString()); }; +%> + \ No newline at end of file diff --git a/letoy.css b/letoy.css new file mode 100644 index 0000000..5731f85 --- /dev/null +++ b/letoy.css @@ -0,0 +1,273 @@ +a:link {color:#c7f200; text-decoration:none;} +a:visited {color:#c7f200; text-decoration:none;} +a:hover {color:#c7f200; text-decoration:none; cursor:pointer} +a:active {color:#5c9d00; text-decoration:none;} + +h1{ + font-family: "Hobo Std"; + color: #47ca86; + font-size: 1.5em; + margin:0px; +} + +h2{ + font-family: "Hobo Std"; + color: #47ca86; + font-size: 1em; + margin:0px; +} + +h3{ + font-family: "Hobo Std"; + color: #000000; + font-size: 1em; + margin:0px; +} + +p{ + font-family: "Hobo Std"; + color: #000000; + font-size: 0.8em; + margin:0px; +} + +body +{ +background-color:#e0f4ff; +background-image:url('resource/bg.jpg'); +background-repeat:repeat; +text-align:center; +} + +.image{ + display:block; + float:left; + position:relative; + width:160px; + height:160px; + background:#333333; +} + +#topBorder{ + display:block; + position:relative; + top:0px; + padding:0px; + width: 100%; + height: 40px; +} + +#footer{ + display:block; + position:relative; + margin-top: 30px; + padding:0px; + width: 100%; + height: 40px; + font-family: "Hobo Std"; + color: #47ca86; + font-size: 0.6em; + text-align: center; +} + +#contentArea{ + display:inline-block; + position:relative; + padding:10px; + width: 800px; + background: #ffffff; +} + +#header{ + font-family: "Hobo Std"; + font-size: 1em; + color: #ffffff; + display:block; + position:fixed; + top:0px; + left:0px; + right:0px; + padding:0px; + width: 100%; + height: 34px; + background: #47ca86; +} + +.textInput{ + font-family: "Hobo Std"; + color: #000000; + font-size: 0.8em; + border: 0px; + background: #dddddd; +} + +#searchBar { + width: 120px; + height: 20px; + position:fixed; + top:5px; + left:120px; +} + +.button { + border:0px; + font-family: "Hobo Std"; + font-size: 1em; + color: #ffffff; + background:#c7f200; + background-repeat:no-repeat; + background-position:center center; + transition:color 0.2s,background 0.2s; +} +.button:hover { + color: #000000; + background:#f2dd00; + cursor:pointer; +} + +.buttonFake { + border:0px; + font-family: "Hobo Std"; + font-size: 1em; + color: #444444; + background:#666666; + background-repeat:no-repeat; + background-position:center center; +} + +#searchButton { + background-image:url('resource/searchButton.png'); + width: 22px; + height: 22px; + position:fixed; + top:5px; + left:240px; +} +#searchButton:hover{ + background-image:url('resource/searchButtonHover.png'); +} + +#cancelButton { + position:relative; + float:right; +} + +.buttonHeader { + border:0px; + font-family: "Hobo Std"; + font-size: 1em; + background: #47ca86; + color: #c7f200; + position:fixed; + top:0px; + height:34px; + transition: color 0.2s, font-size 0.2s; +} +.buttonHeader:hover{ + color: #ffffff; + font-size: 1.2em; + cursor:pointer; +} + +#register{ + right:30px; +} + +#login{ + right:105px; +} + +#logout{ + right:30px; +} + +#shoppingChart{ + left:430px; +} + +#profile{ + right:105px; +} + + +.dropDown { + background: #47ca86; + font-family: "Hobo Std"; + font-size: 0.8em; + color: #ffffff; +} +.dropdown:hover{ + cursor:pointer; +} + +#kategoriDropDown { + width: 120px; + height: 20px; + position:fixed; + top:6px; + left:285px; +} + +#logo{ + position:fixed; + top:0px; + left:0px; +} + +@keyframes myfirst +{ +0% {left:0px; top:0px;} +50% {left:300px; top:200px;} +100% {left:0px; top:0px;} +} + +@-webkit-keyframes myfirst /* Safari and Chrome */ +{ +0% {left:0px; top:0px;} +50% {left:300px; top:200px;} +100% {left:0px; top:0px;} +} + +#popupLoginBubble{ + background-image:url('resource/bubbleLogin.png'); + width: 190px; + height: 190px; + display:block; + position:fixed; + top:35px; + right:20px; +} +#popupLoginContent{ + margin: 30px 10px 10px; +} + +.errorMsg{ + font-family: "Hobo Std"; + font-size: 0.8em; + color: #ff0000; +} + +.fullLine{ + display:inline-block; + margin:0px; + width:800px; +} + +.halfLineToR{ + display:inline-block; + float:left; + text-align:right; + margin:0px; + width:200px; +} +.halfLineToL{ + display:inline-block; + text-align:left; + float:left; + margin:0px; + width:500px; +} + +#hilang { + visibility:hidden; +} \ No newline at end of file diff --git a/profile.css b/profile.css new file mode 100644 index 0000000..9d41a92 --- /dev/null +++ b/profile.css @@ -0,0 +1,7 @@ +#profileView { + display:inline-block; + width:100%; + background:#FFFFFF; + float:left; + text-align:left; +} \ No newline at end of file diff --git a/profile.jsp b/profile.jsp new file mode 100644 index 0000000..f636733 --- /dev/null +++ b/profile.jsp @@ -0,0 +1,133 @@ +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<% + Connection con = null; + String[] data = new String[8]; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + PreparedStatement st; + String query = "SELECT * FROM user WHERE username=?"; + + st = con.prepareStatement(query); + st.setString(1, request.getParameter("username")); + + ResultSet rs; + rs = st.executeQuery(); + + if (rs.next()) { + + +%> + + + + + + + + + + + + + + +
+
+
+

Profile

+

Username : <%= rs.getString(1) %>

+

Nama Lengkap: <%= rs.getString(3) %>

+

Email : <%= rs.getString(10) %>

+

Alamat : <%= rs.getString(4) %>

+

Provinsi: <%= rs.getString(5) %>

+

Kota : <%= rs.getString(6) %>

+

Kode Pos : <%= rs.getString(7) %>

+

No Hp: <%= rs.getString(8) %>

+

Jumlah Transaksi: <%= rs.getString(11)%>

+ +
+
+ + +<% } + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println(e.toString()); }; +%> + \ No newline at end of file diff --git a/progin_13511039.sql b/progin_13511039.sql new file mode 100644 index 0000000..e790ab8 --- /dev/null +++ b/progin_13511039.sql @@ -0,0 +1,150 @@ +-- phpMyAdmin SQL Dump +-- version 3.5.2.2 +-- http://www.phpmyadmin.net +-- +-- Inang: 127.0.0.1 +-- Waktu pembuatan: 27 Nov 2013 pada 14.35 +-- Versi Server: 5.5.27 +-- Versi PHP: 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 */; + +-- +-- Basis data: `ruserba` +-- + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `barang` +-- + +CREATE TABLE IF NOT EXISTS `barang` ( + `nama` varchar(50) NOT NULL, + `keterangan` varchar(100) NOT NULL, + `harga` int(11) NOT NULL, + `kategori` varchar(50) NOT NULL, + `jumlah` int(11) NOT NULL, + `popularitas` int(11) NOT NULL, + PRIMARY KEY (`nama`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data untuk tabel `barang` +-- + +INSERT INTO `barang` (`nama`, `keterangan`, `harga`, `kategori`, `jumlah`, `popularitas`) VALUES +('Apel Mematikan', 'Apel yang kalo dimakan apelnya mati.', 10000, 'makanan', 10, 14), +('Baju Sang Ksatria', 'Baju biar keliatan kaya Ksatria.', 100000, 'pakaian', 1, 7), +('Buah Rangga', 'Buah yang berasal dari keharmonisan Rangga (Rumah tangga).', 20000, 'makanan', 20, 32), +('Celana Kasat Mata', 'Celana yang baru bisa digunakan setelah mengkasatkan mata yang menggunakan.', 200000, 'pakaian', 5, 6), +('Ikan Hasil Nelayan', 'Nelayan telah berusaha keras menangkap ikan. Terma kasih banyak om nelayan.', 15000, 'makanan', 2, 3), +('Kursi Menghindar', 'Kursi ini tidak suka diduduki, akan selalu menghindar jika tidak diberi susu.', 500000, 'furnitur', 2, 21), +('Lemari Bau Melon', 'Nikmati kehidupan anda di rumah baru dengan furnitur yang selalu menghasilkan bau melon!', 50000, 'furnitur', 10, 23), +('Lubang Hidung Tambahan', 'Gunakan di bagian telinga untuk menambah jumlah lubang hidung.', 70000, 'aksesoris', 10, 12), +('Meja Terbang', 'Meja yang bisa terbang sesuai dengan keinginan yang diatas.', 45000, 'furnitur', 4, 2), +('NerveGear', 'Mainan ini dapat mempermainkan saraf kamu! Nikmati sensasi menggerakan tangan padahal ingin menggera', 400000, 'mainan', 4, 3), +('Pbox4', 'Argh saya mau beli PS4 D:', 5000000, 'mainan', 10, 23), +('Sarung Tangan Bentuk Kaki', 'Sarung tangan yang dibuat dari kulit kaki manusia asli.', 30000, 'aksesoris', 5, 1), +('SBoxONE', 'Udah ga kreatif lagi bikin nama...', 10000, 'mainan', 1, 1), +('Sepatu Untuk Kaki', 'Sebuah benda yang digunakan di kaki.', 5000, 'aksesoris', 7, 11), +('Topi Anti Maling', 'Topi yang akan melindungi kita dari berubah menjadi maling.', 250000, 'pakaian', 1, 17); + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `cart` +-- + +CREATE TABLE IF NOT EXISTS `cart` ( + `namabarang` varchar(50) NOT NULL, + `jumlah` int(11) NOT NULL, + `keterangan` varchar(200) NOT NULL, + `username` varchar(50) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `creditcard` +-- + +CREATE TABLE IF NOT EXISTS `creditcard` ( + `nomorkartu` varchar(50) NOT NULL, + `namakartu` varchar(50) NOT NULL, + `expired` date NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data untuk tabel `creditcard` +-- + +INSERT INTO `creditcard` (`nomorkartu`, `namakartu`, `expired`) VALUES +('1234', 'kartusaya', '2014-04-04'); + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `have` +-- + +CREATE TABLE IF NOT EXISTS `have` ( + `username` varchar(50) NOT NULL, + `nomorkartu` varchar(50) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data untuk tabel `have` +-- + +INSERT INTO `have` (`username`, `nomorkartu`) VALUES +('yanuararistya', '1234'), +('aksel5556', '1234'), +('jemsjems', '1234'); + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `user` +-- + +CREATE TABLE IF NOT EXISTS `user` ( + `username` varchar(50) NOT NULL, + `password` varchar(50) NOT NULL, + `fullname` varchar(50) NOT NULL, + `alamat` varchar(50) NOT NULL, + `provinsi` varchar(50) NOT NULL, + `kota` varchar(50) NOT NULL, + `kodepos` varchar(50) NOT NULL, + `nohp` varchar(50) NOT NULL, + `tipe` varchar(50) NOT NULL, + `email` varchar(50) NOT NULL, + `transaksi` int(11) NOT NULL, + PRIMARY KEY (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data untuk tabel `user` +-- + +INSERT INTO `user` (`username`, `password`, `fullname`, `alamat`, `provinsi`, `kota`, `kodepos`, `nohp`, `tipe`, `email`, `transaksi`) VALUES +('aksel5556', 'yanuaredi', 'yanuar edi', 'anaslk', 'laskdj ', 'lkasj', 'lkasj', 'lkas', 'pembeli', 'lsad@as.com', 0), +('asdfasdf', 'asdasdasd', 'a ads ads', 'jaskldsaj', 'lkadsj ', 'adslj', 'lasd', 'ldjsa', 'pembeli', 'ljks@moc.com', 0), +('cobain', 'cobacoba', 'coba coba', 'coba c', 'aosid ', 'adls', 'aldkj', 'lkajsd', 'pembeli', 'kljsad@com.com', 0), +('jemsjems', 'asdfasdf', 'asdf asdf', 'asdf ', 'assdf ', 'asd', 'af', 'asd', 'pembeli', 'ad@co.com', 0), +('reigun', 'reireirei', 'reii gun', '091823', 'djsjlka ', 'aslkdj', 'adslkj', 'qladjs', 'pembeli', 'reigun@moc.com', 0), +('yanuar', 'asdasdasd', 'yanua ae', 'dimanapun', 'asdf', 'asdf', 'adf', 'asdf', 'pembeli', 'aasd@com.com', 0), +('yanuararis', 'poklijmunloki', 'asd sad', 'asda', 'asdlkj ', 'asjd', 'lasd', 'saldk', 'pembeli', 'oos@c.com', 0), +('yanuararist', 'asdfasdf', 'lasdj as', 'as', 'as ', 'asd', 'ad', 'ad', 'pembeli', 'sad@com.com', 0), +('yanuararistya', 'poklijmunloki', 'Yanuar Aristya Edy Putra', 'Jalan Tubagus Ismail I no 5', 'Jawa Barat', 'Bandung', '40134', '087867961609', 'admin', 'yanuararistya@gmail.com', 7); + +/*!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/registrasi.html b/registrasi.html new file mode 100644 index 0000000..ea3ac92 --- /dev/null +++ b/registrasi.html @@ -0,0 +1,111 @@ + + + + + + + + + + + + + +
+
+
+

+
+
+
Username :
+

+
+
Password :
+

+
+
Confirm Password :
+

+
+
Nama Lengkap :
+

+
+
Nomor Handphone :
+
+
+
Alamat :
+
+
+
Provinsi :
+
+
+
Kabupaten :
+
+
+
Kode Pos :
+
+
+
Email :
+

+
+ +
+
+

+
+ + + + + + \ No newline at end of file diff --git a/registrasiCC.css b/registrasiCC.css new file mode 100644 index 0000000..2eecfec --- /dev/null +++ b/registrasiCC.css @@ -0,0 +1,15 @@ +#pembayaranView { + display:inline-block; + width:100%; + float:left; + background:#FFFFFF; +} + +#pembayaranView ul { + text-align:left; + list-style-type:none; +} + +#pembayaranView ul li { + padding-bottom:4px; +} \ No newline at end of file diff --git a/registrasiCC.html b/registrasiCC.html new file mode 100644 index 0000000..1b96e33 --- /dev/null +++ b/registrasiCC.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + +
+ +
+
+
    +
  • Registrasi Kartu Kredit!

  • +
  • +

    Nomor Kartu



    +

    Nama



    +

    Tanggal Kadaluarsa ("YYYY-MM-DD")



    + + +
  • +
  • +
+
+
+ + + + + + + \ No newline at end of file diff --git a/resource/Apel Mematikan.jpg b/resource/Apel Mematikan.jpg new file mode 100644 index 0000000..f07a568 Binary files /dev/null and b/resource/Apel Mematikan.jpg differ diff --git a/resource/Baju Sang Ksatria.jpg b/resource/Baju Sang Ksatria.jpg new file mode 100644 index 0000000..efc8ae2 Binary files /dev/null and b/resource/Baju Sang Ksatria.jpg differ diff --git a/resource/Buah Rangga.jpg b/resource/Buah Rangga.jpg new file mode 100644 index 0000000..bea86ac Binary files /dev/null and b/resource/Buah Rangga.jpg differ diff --git a/resource/Celana Kasat Mata.jpg b/resource/Celana Kasat Mata.jpg new file mode 100644 index 0000000..21158f6 Binary files /dev/null and b/resource/Celana Kasat Mata.jpg differ diff --git a/resource/Ikan Hasil Nelayan.jpg b/resource/Ikan Hasil Nelayan.jpg new file mode 100644 index 0000000..da02f95 Binary files /dev/null and b/resource/Ikan Hasil Nelayan.jpg differ diff --git a/resource/Kursi Menghindar.jpg b/resource/Kursi Menghindar.jpg new file mode 100644 index 0000000..67c23d6 Binary files /dev/null and b/resource/Kursi Menghindar.jpg differ diff --git a/resource/Lemari Bau Melon.jpg b/resource/Lemari Bau Melon.jpg new file mode 100644 index 0000000..b46da98 Binary files /dev/null and b/resource/Lemari Bau Melon.jpg differ diff --git a/resource/Lubang Hidung Tambahan.jpg b/resource/Lubang Hidung Tambahan.jpg new file mode 100644 index 0000000..c82cb63 Binary files /dev/null and b/resource/Lubang Hidung Tambahan.jpg differ diff --git a/resource/Meja Terbang.jpg b/resource/Meja Terbang.jpg new file mode 100644 index 0000000..b0a1c04 Binary files /dev/null and b/resource/Meja Terbang.jpg differ diff --git a/resource/NerveGear.jpg b/resource/NerveGear.jpg new file mode 100644 index 0000000..c12f722 Binary files /dev/null and b/resource/NerveGear.jpg differ diff --git a/resource/Pbox4.jpg b/resource/Pbox4.jpg new file mode 100644 index 0000000..ab1572f Binary files /dev/null and b/resource/Pbox4.jpg differ diff --git a/resource/SBoxONE.jpg b/resource/SBoxONE.jpg new file mode 100644 index 0000000..11217c7 Binary files /dev/null and b/resource/SBoxONE.jpg differ diff --git a/resource/Sarung Tangan Bentuk Kaki.jpg b/resource/Sarung Tangan Bentuk Kaki.jpg new file mode 100644 index 0000000..a1b37e0 Binary files /dev/null and b/resource/Sarung Tangan Bentuk Kaki.jpg differ diff --git a/resource/Sepatu Untuk Kaki.jpg b/resource/Sepatu Untuk Kaki.jpg new file mode 100644 index 0000000..c4cb095 Binary files /dev/null and b/resource/Sepatu Untuk Kaki.jpg differ diff --git a/resource/Topi Anti Maling.jpg b/resource/Topi Anti Maling.jpg new file mode 100644 index 0000000..1a557e9 Binary files /dev/null and b/resource/Topi Anti Maling.jpg differ diff --git a/resource/bubbleLogin.png b/resource/bubbleLogin.png new file mode 100644 index 0000000..ea59fb3 Binary files /dev/null and b/resource/bubbleLogin.png differ diff --git a/resource/logo.png b/resource/logo.png new file mode 100644 index 0000000..41899e8 Binary files /dev/null and b/resource/logo.png differ diff --git a/resource/searchButton.png b/resource/searchButton.png new file mode 100644 index 0000000..d68a755 Binary files /dev/null and b/resource/searchButton.png differ diff --git a/resource/searchButtonHover.png b/resource/searchButtonHover.png new file mode 100644 index 0000000..177dcf8 Binary files /dev/null and b/resource/searchButtonHover.png differ diff --git a/shoppingbag.css b/shoppingbag.css new file mode 100644 index 0000000..97ecfb1 --- /dev/null +++ b/shoppingbag.css @@ -0,0 +1,70 @@ +.shoppedItem{ + display:inline-block; + width:600px; + font-family: "Hobo Std"; + color: #47ca86; + font-size: 1em; + transition:color 0.2s,background 0.2s; +} +.shoppedItem:hover{ + background:#c7f200; + color: #000000; +} + +.shoppedItemName{ + text-align:left; + display:block; + float:left; + width:200px; +} + +.shoppedItemNumber{ + text-align:right; + display:block; + float:left; + width:70px; +} + +.shoppedItemPrice{ + text-align:right; + display:block; + float:left; + width:165px; +} + +#titleLine{ + display:inline-block; + width:600px; + font-family: "Hobo Std"; + color: #ffffff; + font-size: 1.2em; + background: #47ca86; +} + +#bottomLine{ + display:inline-block; + width:600px; + font-family: "Hobo Std"; + color: #ffffff; + font-size: 1.4em; + background: #47ca86; +} + +#payButton{ + font-size: 1.4em; + margin-left: 20px; + display:inline-block; + width:100px; +} + +.eraseItem{ + font-family: "Hobo Std"; + margin-left: 20px; + color: #c7f200; + display:inline-block; + width:100px; +} +.eraseItem:hover{ + color: #ff0000; + cursor:pointer; +} \ No newline at end of file diff --git a/shoppingbag.jsp b/shoppingbag.jsp new file mode 100644 index 0000000..eae862d --- /dev/null +++ b/shoppingbag.jsp @@ -0,0 +1,113 @@ + +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<% + Connection con = null; + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + String query = "SELECT * FROM cart WHERE username='yanuararistya'"; + PreparedStatement st = con.prepareStatement(query); + + ResultSet rs = st.executeQuery(); + + st.clearParameters(); +%> + + + + + + + + + + +
+ +
+
+
Nama Barang
+
Harga Satuan
+
Jumlah
+
Total
+
+ +
+ <% + int total = 0; + while(rs.next()) { + Connection con2 = null; + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con2 = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + String query2 = "SELECT harga FROM barang WHERE nama=?"; + PreparedStatement st2 = con.prepareStatement(query2); + st2.setString(1, rs.getString(1)); + + ResultSet rs2 = st2.executeQuery(); + + if (rs2.next()) { + out.println("
"); + out.println("
"+rs.getString(1)+"
"); + out.println("
"+rs2.getString(1)+"
"); + out.println("
"+rs.getInt(2)+"
"); + out.println("
"+rs2.getInt(1) * rs.getInt(2)+"
"); + out.println("
"); + total += rs2.getInt(1) * rs.getInt(2); + } + + st2.clearParameters(); + con2.close(); + } catch (Exception e) {out.println(e.toString()); }; + } + %> +
+ +
+
Total
+
-
+
-
+
Rp. <%= total %>
+
+
+ +
+ + + + +<% + con.close(); + } catch (Exception e) {out.println(e.toString()); }; +%> + \ No newline at end of file diff --git a/test.jsp b/test.jsp new file mode 100644 index 0000000..e9b527f --- /dev/null +++ b/test.jsp @@ -0,0 +1,44 @@ + + + + + + + +
+ + \ No newline at end of file diff --git a/validateCC.jsp b/validateCC.jsp new file mode 100644 index 0000000..6545eef --- /dev/null +++ b/validateCC.jsp @@ -0,0 +1,52 @@ +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> + +<% + Connection con = null; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + PreparedStatement st; + String query = "SELECT nomorkartu, namakartu FROM creditcard WHERE nomorkartu=? AND namakartu=?"; + st = con.prepareStatement(query); + st.setString(1, request.getParameter("nomor_kartu")); + st.setString(2, request.getParameter("nama")); + + ResultSet rs; + rs = st.executeQuery(); + + boolean success = false; + if (rs.next()) { + success = true; + response.getWriter().print(1); + } else response.getWriter().print(0); + + if (success) { + Connection con2; + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + con2 = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + PreparedStatement st2; + String query2 = "INSERT INTO have(username, nomorkartu) VALUES(?, ?)"; + st2 = con2.prepareStatement(query2); + st2.setString(1, request.getParameter("username")); + st2.setString(2, rs.getString(1)); + + st2.executeUpdate(); + st2.clearParameters(); + con2.close(); + } catch (Exception e) {out.println(e.toString());} + } + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println(e.toString()); }; + +%> \ No newline at end of file diff --git a/validateLogin.jsp b/validateLogin.jsp new file mode 100644 index 0000000..a310572 --- /dev/null +++ b/validateLogin.jsp @@ -0,0 +1,22 @@ +<% + Connection con = null; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + PreparedStatement st = con.prepareStatement("SELECT password FROM user where username=?"); + st.setString(1, request.getParameter("username")); + + ResultSet rs; + rs = st.executeQuery(); + + response.getWriter().write("AFSASDASD"); + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println("Unable to connect to database."); }; +%> \ No newline at end of file diff --git a/validator.js b/validator.js new file mode 100644 index 0000000..530ea69 --- /dev/null +++ b/validator.js @@ -0,0 +1,134 @@ +var u; +var p; +var cp; +var nl; +var e; +var hp; +var al; +var pr; +var kab; +var kp; +var vp; +var vcp; +var vnl; +var vun = Boolean(); +var vemail = Boolean(); +var ulength = Boolean(); +var elength = Boolean(); +var buttonon = Boolean(); + +buttonon = false; + +function valun(s){ + if (s.length<5) { + document.getElementById("vun").innerHTML="username minimal terdiri dari 5 huruf
"; + ulength = false; + } + else { + document.getElementById("vun").innerHTML=""; + ulength = true; + } +} +function valun2(s){ + loadXMLDoc("checkUsername.jsp?u="+s, function() + { + if (xmlhttp.readyState == 4) { + var response= ""; + response = xmlhttp.response; + if (response == 1) { + document.getElementById("vun2").innerHTML=""; + vun = true; + } + else { + document.getElementById("vun2").innerHTML=response; + vun = false; + } + } + } + ); +} +function valp(s){ + if (s.length<8) { + document.getElementById("vp").innerHTML="password minimal terdiri dari 8 huruf
"; + vp = false; + } else { + var un = document.getElementById('txt_un').value; + var email = document.getElementById('txt_email').value; + if ((s == un) || (s == email)) { + document.getElementById("vp").innerHTML="password tidak boleh sama dengan username/email
"; + vp = false; + } + else { + document.getElementById("vp").innerHTML=""; + vp = true; + } + } +} + +function valpEdit(s){ + if (s.length<8) { + document.getElementById("vp").innerHTML="password minimal terdiri dari 8 huruf
"; + vp = false; + } else { + var un = localStorage.getItem('activeUser'); + var email = document.getElementById('txt_email').value; + if ((s == un) || (s == email)) { + document.getElementById("vp").innerHTML="password tidak boleh sama dengan username/email
"; + vp = false; + } + else { + document.getElementById("vp").innerHTML=""; + vp = true; + } + } +} + +function valcp(s){ + var p = document.getElementById('txt_pass').value; + if (s == p) { + document.getElementById("vcp").innerHTML=""; + vcp = true; + } + else { + document.getElementById("vcp").innerHTML="confirm password harus sama dengan password
"; + vcp = false; + } +} +function valnl(s){ + var name = /[A-Za-z]+\s[A-Za-z]+/; + if (name.test(s)) { + document.getElementById("vnl").innerHTML=""; + vnl = true; + } else { + document.getElementById("vnl").innerHTML="nama lengkap harus terdiri dari first dan last name
"; + vnl = false; + } +} +function valemail(s){ + var email = /[A-Za-z0-9_.][A-Za-z0-9_.]+[@]\w+[.]\w+/; + if (!email.test(s)) { + document.getElementById("vemail").innerHTML="email tidak sesuai format yang benar, format yang benar adalah minimal xx@x.x
"; + elength=false; + } else { + document.getElementById("vemail").innerHTML=""; + elength=true; + } +} +function valemail2(s){ + loadXMLDoc("checkEmail.jsp?e="+s, function() + { + if (xmlhttp.readyState == 4) { + var response = ""; + response = xmlhttp.response; + if (response == 1) { + vemail = true; + document.getElementById("vemail2").innerHTML=""; + } + else { + document.getElementById("vemail2").innerHTML=response; + vemail = false; + } + } + } + ); +} diff --git a/verifyLogin.jsp b/verifyLogin.jsp new file mode 100644 index 0000000..2a1ec0e --- /dev/null +++ b/verifyLogin.jsp @@ -0,0 +1,32 @@ +<%@ page import="java.sql.*, javax.sql.*, java.io.*, javax.naming.*" %> +<% + Connection con = null; + + try { + try { + Class.forName("com.mysql.jdbc.Driver").newInstance(); + }catch(ClassNotFoundException ce){out.println(ce);} + + con = DriverManager.getConnection("jdbc:mysql://localhost/ruserba","root",""); + + String usr = request.getParameter("username"); + String pass = request.getParameter("password"); + + PreparedStatement st; + + st = con.prepareStatement("SELECT username FROM user WHERE username=? AND password=?"); + st.setString(1, usr); + st.setString(2, pass); + + ResultSet rs; + rs = st.executeQuery(); + + if (rs.next()) + response.getWriter().print(rs.getString(1)); + else response.getWriter().print(0); + + st.clearParameters(); + con.close(); + } catch (Exception e) {out.println("Unable to connect to database."); }; + +%> \ No newline at end of file