diff --git a/assets/css/screen.css b/assets/css/screen.css index 1d8fdf3b..f7f03e60 100644 --- a/assets/css/screen.css +++ b/assets/css/screen.css @@ -157,7 +157,7 @@ a:hover { z-index: 2; } .nav.fixed { - position: fixed; + /*position: fixed;*/ } #logo { float: left; @@ -228,12 +228,12 @@ div.cover > img { height: 900px; /* Background image is defined in the post */ background-position: top center; - background-attachment: fixed; + /*background-attachment: scroll;*/ overflow: hidden; } /* Contains the time, title and subtitle for an article */ .art-header-inner { - position: fixed; + position: absolute; top: 300px; left: 50%; margin-left: -490px; @@ -243,6 +243,7 @@ div.cover > img { .art-subtitle { text-align: center; text-transform: uppercase; + position: absolute; } .art-time { font-size: 14px; @@ -275,6 +276,7 @@ div.cover > img { .art-body { position: relative; width: 100%; + margin-top: 100px; background: #fff; z-index: 100; -webkit-box-shadow: 0 -3px 3px rgba(0,0,0,.2); diff --git a/build.xml b/build.xml new file mode 100644 index 00000000..ec29b4ea --- /dev/null +++ b/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project IF3110-02-Simple-Blog-Java. + + + diff --git a/build/web/AddForm.jsp b/build/web/AddForm.jsp new file mode 100644 index 00000000..28d5a3c9 --- /dev/null +++ b/build/web/AddForm.jsp @@ -0,0 +1,27 @@ +<%-- + Document : add + Created on : Nov 25, 2014, 6:30:47 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + +

User Details

+
+
Username : +
Password : +
Role : +
Email : +

+
+
+
+ Back to main page + + diff --git a/build/web/LoginCheck.jsp b/build/web/LoginCheck.jsp new file mode 100644 index 00000000..2be071e1 --- /dev/null +++ b/build/web/LoginCheck.jsp @@ -0,0 +1,99 @@ +<%-- + Document : LoginCheck + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + Login Check + + + <% + String username=request.getParameter("username"); + String password=request.getParameter("password"); + String passwordS = ""; // dari SQL + String rol = ""; + int user_id = 0; + + Connection con = null; + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Retrieve password and role + try + { + String sql=("SELECT user_id, password, role FROM user WHERE nama='"+username+"'"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + + String[] pass = null; + int rl = 0; + int user = 0; + while (rs.next()){ + String em = rs.getString("password"); + rl = rs.getInt("role"); + user = rs.getInt("user_id"); + pass = em.split("\n"); + for (int i =0; i < pass.length; i++){ + System.out.println(pass[i]); + } + } + if (pass != null){ + passwordS = pass[0]; + + switch (rl){ + case 1: rol = "Owner"; break; + case 2: rol = "Editor"; break; + case 3: rol = "Admin"; break; + default : rol = "Guest"; break; + } + + user_id = user; + } + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + + if( password.equals(passwordS)) + { + session.setAttribute("username",username); + session.setAttribute("password",password); + session.setAttribute("role",rol); + session.setAttribute("user_id",user_id); + response.sendRedirect("cookies.jsp"); + } + else + response.sendRedirect("index.jsp"); + + %> + + + diff --git a/build/web/META-INF/MANIFEST.MF b/build/web/META-INF/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/build/web/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/build/web/META-INF/context.xml b/build/web/META-INF/context.xml new file mode 100644 index 00000000..38bc2b4c --- /dev/null +++ b/build/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/build/web/ManagementUser.jsp b/build/web/ManagementUser.jsp new file mode 100644 index 00000000..9812880e --- /dev/null +++ b/build/web/ManagementUser.jsp @@ -0,0 +1,107 @@ +<%-- + Document : ManagementUser + Created on : Nov 24, 2014, 5:24:10 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + Management User + + + + + + + + + + + + + <% + + Connection con = null; + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Retrieve password and role + try + { + String sql=("SELECT user_id, nama, password, role, email FROM user"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + + while (rs.next()){ + String x = rs.getString("nama"); + String y = rs.getString("password"); + String email = rs.getString("email"); + int z = rs.getInt("role"); + int user_id = rs.getInt("user_id"); + %> + + + + + + + + + + + + <% + + } + + rs.close(); + con.close(); + %> +
NamePasswordRoleEmailUpdateDelete
<% out.println(x); %><% out.println(y); %><% out.println(z); %><% out.println(email); %>
+ + <% + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +
+
+
+
+ Back to main page + + + \ No newline at end of file diff --git a/build/web/PostGuest.jsp b/build/web/PostGuest.jsp new file mode 100644 index 00000000..c0e51c8a --- /dev/null +++ b/build/web/PostGuest.jsp @@ -0,0 +1,356 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + Connection con2 = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con2 = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con2.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(rs.getString("judul")); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> + + + + + + +
+ + + +
+ +
+
+ +
+

+ <% + Connection con1 = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con1 = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con1.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(rs.getString("judul")); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +

+

+
+
+ +
+
+
+ <% + Connection con = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println("

" + + rs.getString("konten") + + "

"); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +
+ +

Komentar

+ +
+
+ + "> + + + + + + + +
+ + + +
+
+ +
+
    + <% + try + { + String sql=("SELECT * FROM komentar WHERE post_id=" + + "\'" + +request.getParameter("post_id") + + "\'" + +" ORDER BY komentar_tanggal DESC"); + /*String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id"));*/ + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + + out.println("
  • "); + out.println("
    "); + out.println("

    "); + out.println(rs.getString("komentar_nama")); + out.println("

    "); + out.println("
    "); + out.println(rs.getString("komentar_tanggal")); + out.println("
    "); + out.println("
    "); + out.println("

    "); + out.println(rs.getString("komentar_konten")); + out.println("

    "); + out.println("
  • "); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +
+
+ + +
+
+ +
+ + + +
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/build/web/UpdateForm.jsp b/build/web/UpdateForm.jsp new file mode 100644 index 00000000..2467005c --- /dev/null +++ b/build/web/UpdateForm.jsp @@ -0,0 +1,73 @@ +<%-- + Document : UpdateForm + Created on : Nov 25, 2014, 4:55:12 PM + Author : Teofebano +--%> + +<%@page import="java.sql.ResultSet"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.SQLException"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + <% + Connection con = null; + String user_id= request.getParameter("user_id"); + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + try + { + String sql=("SELECT nama, password, role,email FROM user WHERE user_id='" +user_id+ "'"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + String x = rs.getString("nama"); + String y = rs.getString("password"); + int z = rs.getInt("role"); + String w = rs.getString("email"); + %> +

Update Details

+
+
Username : +
Password : +
Role : +
Email : +

+
+ <% + + } + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> + + + diff --git a/build/web/WEB-INF/classes/.netbeans_automatic_build b/build/web/WEB-INF/classes/.netbeans_automatic_build new file mode 100644 index 00000000..e69de29b diff --git a/build/web/WEB-INF/classes/.netbeans_update_resources b/build/web/WEB-INF/classes/.netbeans_update_resources new file mode 100644 index 00000000..e69de29b diff --git a/build/web/WEB-INF/classes/com/tegar/databasehandler/AddCommentHandling.class b/build/web/WEB-INF/classes/com/tegar/databasehandler/AddCommentHandling.class new file mode 100644 index 00000000..8ab4aac5 Binary files /dev/null and b/build/web/WEB-INF/classes/com/tegar/databasehandler/AddCommentHandling.class differ diff --git a/build/web/WEB-INF/classes/com/tegar/databasehandler/AddPostHandling.class b/build/web/WEB-INF/classes/com/tegar/databasehandler/AddPostHandling.class new file mode 100644 index 00000000..13ca1c38 Binary files /dev/null and b/build/web/WEB-INF/classes/com/tegar/databasehandler/AddPostHandling.class differ diff --git a/build/web/WEB-INF/classes/com/tegar/databasehandler/DatabaseHandler.class b/build/web/WEB-INF/classes/com/tegar/databasehandler/DatabaseHandler.class new file mode 100644 index 00000000..7d5cac88 Binary files /dev/null and b/build/web/WEB-INF/classes/com/tegar/databasehandler/DatabaseHandler.class differ diff --git a/build/web/WEB-INF/classes/com/tegar/databasehandler/DeletePostHandling.class b/build/web/WEB-INF/classes/com/tegar/databasehandler/DeletePostHandling.class new file mode 100644 index 00000000..8fd259d2 Binary files /dev/null and b/build/web/WEB-INF/classes/com/tegar/databasehandler/DeletePostHandling.class differ diff --git a/build/web/WEB-INF/classes/com/tegar/databasehandler/EditPostHandling.class b/build/web/WEB-INF/classes/com/tegar/databasehandler/EditPostHandling.class new file mode 100644 index 00000000..7a0f6925 Binary files /dev/null and b/build/web/WEB-INF/classes/com/tegar/databasehandler/EditPostHandling.class differ diff --git a/build/web/WEB-INF/classes/com/tegar/databasehandler/PublishPostHandling.class b/build/web/WEB-INF/classes/com/tegar/databasehandler/PublishPostHandling.class new file mode 100644 index 00000000..c71b88da Binary files /dev/null and b/build/web/WEB-INF/classes/com/tegar/databasehandler/PublishPostHandling.class differ diff --git a/build/web/WEB-INF/classes/com/tegar/databasehandler/RestorePostHandling.class b/build/web/WEB-INF/classes/com/tegar/databasehandler/RestorePostHandling.class new file mode 100644 index 00000000..4c78714f Binary files /dev/null and b/build/web/WEB-INF/classes/com/tegar/databasehandler/RestorePostHandling.class differ diff --git a/build/web/WEB-INF/lib/javaee-doc-api.jar b/build/web/WEB-INF/lib/javaee-doc-api.jar new file mode 100644 index 00000000..bdebe91c Binary files /dev/null and b/build/web/WEB-INF/lib/javaee-doc-api.jar differ diff --git a/build/web/WEB-INF/lib/javax.annotation.jar b/build/web/WEB-INF/lib/javax.annotation.jar new file mode 100644 index 00000000..ec4b3723 Binary files /dev/null and b/build/web/WEB-INF/lib/javax.annotation.jar differ diff --git a/build/web/WEB-INF/lib/jaxb-api-osgi.jar b/build/web/WEB-INF/lib/jaxb-api-osgi.jar new file mode 100644 index 00000000..d167e2f6 Binary files /dev/null and b/build/web/WEB-INF/lib/jaxb-api-osgi.jar differ diff --git a/build/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar b/build/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar new file mode 100644 index 00000000..0236900b Binary files /dev/null and b/build/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar differ diff --git a/build/web/WEB-INF/lib/org-netbeans-modules-java-j2seproject-copylibstask.jar b/build/web/WEB-INF/lib/org-netbeans-modules-java-j2seproject-copylibstask.jar new file mode 100644 index 00000000..14c3bbbf Binary files /dev/null and b/build/web/WEB-INF/lib/org-netbeans-modules-java-j2seproject-copylibstask.jar differ diff --git a/build/web/WEB-INF/lib/webservices-api-osgi.jar b/build/web/WEB-INF/lib/webservices-api-osgi.jar new file mode 100644 index 00000000..217424da Binary files /dev/null and b/build/web/WEB-INF/lib/webservices-api-osgi.jar differ diff --git a/build/web/WEB-INF/web.xml b/build/web/WEB-INF/web.xml new file mode 100644 index 00000000..58943b55 --- /dev/null +++ b/build/web/WEB-INF/web.xml @@ -0,0 +1,16 @@ + + + + AddPostHandling + com.tegar.databasehandler.AddPostHandling + + + AddPostHandling + /AddPostHandling + + + + 30 + + + diff --git a/build/web/add.jsp b/build/web/add.jsp new file mode 100644 index 00000000..43684e69 --- /dev/null +++ b/build/web/add.jsp @@ -0,0 +1,64 @@ +<%-- + Document : add + Created on : Nov 25, 2014, 6:32:38 PM + Author : Teofebano +--%> + +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.SQLException"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + <% + String a=request.getParameter("username").toString(); + String b=request.getParameter("password").toString(); + int c= Integer.parseInt(request.getParameter("role")); + String d=request.getParameter("email").toString(); + + + %> + <% + Connection con = null; + + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + try + { + String sql=("INSERT INTO user(role, nama, password, email) VALUES ('"+ c +"','"+ a +"','"+ b +"','"+ d +"')"); + PreparedStatement ps = con.prepareStatement(sql); + ps.executeUpdate(sql); + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + + + response.sendRedirect("ManagementUser.jsp"); + %> + + diff --git a/build/web/assets/css/screen.css b/build/web/assets/css/screen.css new file mode 100644 index 00000000..3653e27b --- /dev/null +++ b/build/web/assets/css/screen.css @@ -0,0 +1,862 @@ +@import url(http://fonts.googleapis.com/css?family=Open+Sans); +@import url(http://fonts.googleapis.com/css?family=Questrial); + +/* Reset & Basics (Inspired by E. Meyers) +================================================== */ +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, address, cite, code, em, img, small, strong, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, embed, figure, figcaption, footer, header, hgroup, menu, nav, section, summary, time, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; } +article, aside, details, figcaption, figure, footer, header, hgroup, menu, time, nav, section { + display: block; } +html, body, .wrapper { + min-height: 100%; +} + + +/* Body +================================================== */ +html, body { + height: 100%; +} +.wrapper { + min-height: 100%; +} +body { + overflow-x: hidden; + font: 17px/28px ff-meta-serif-web-pro, "Georgia", serif; + color: #333; + background: #fff; +} + + +/* Typography +================================================== */ +h1, h2, h3, h4, h5, h6 { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: normal; + text-transform: uppercase; + font-weight: 700; + color: #000; + text-rendering: optimizeLegibility; +} + +h1 { + font-size: 50px; + padding-bottom: 30px; +} + +h2 { + font-size: 45px; + padding-bottom: 25px; +} + +h3 { + font-size: 40px; + padding-bottom: 20px; +} + +h4 { + font-size: 35px; + padding-bottom: 15px; +} + +h5 { + font-size: 30px; + padding-bottom: 10px; +} + +p { + margin: 0 0 28px 0; +} + +strong { + font-weight: bold; +} +em { + font-style: italic; +} +sup { + line-height: 0; +} + +small { + font-size: 70%; +} + +cite { + font-size: 80%; + font-style: italic; + } + +/* Teaser +================================================== */ + +header#teaser h1 { + text-transform: none !important; + color: #333; + font-size: 28px !important; + font-weight: 300 !important; +} + + +/* Links +================================================== */ +a { + color: #F40034; + text-decoration: none; + -webkit-transition: color .2s ease-in-out; + -moz-transition: color .2s ease-in-out; + transition: color .2s ease-in-out; +} +a:hover { + color: #F40034; +} + +/* Layout +================================================== */ +/* White container that is the "page" */ +.wrapper { + max-width: 1500px; + margin: 0 auto; + background: #fff; +} + +/* Containers to keep content to a set width */ +.nav, +.art-header-inner, +.footer, +.art-list, +.abt, +.fourohfour { + width: 980px; +} +.nav, +.art-body-inner, +.footer, +.art-list, +.abt, +.fourohfour { + position: relative; + margin: 0 auto; +} + +/* Nav +================================================== */ +.nav { + position: absolute; + top: 0; + left: 50%; + height: 70px; + padding-top: 40px; + margin-left: -490px; /* Half width of nav */ + border-bottom: 1px solid #333; + z-index: 2; +} +.nav.fixed { + position: fixed; +} +#logo { + float: left; +} +.nav-primary { + float: right; +} +.nav-primary li { + display: inline-block; + margin-left: 10px; + font-weight: 500; +} +#logo h1, +.nav-primary li, +.nav-primary li a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: 700; + font-size: 13px; + line-height: 30px; + color: #000; + text-transform: uppercase; +} + +#logo h1 { + height: 30px; + margin-left: 0px; + letter-spacing: 1px; + font-family: 'Questrial', sans-serif; + font-size: 30px; +} + +#logo h1 span{ + color: #F40034 !important; +} + +.nav li:first-child { + margin-left: 0; /* Remove left margin from the first nav li */ +} + +/* Home Page +================================================== */ + +div#home {} + +#home > div.cover { + max-width: 980px; + margin: 0px auto; + /*padding-top: 110px;*/ +} + +div.cover { + +} + +div.cover > img { + width: 100%; + height: 100%; +} + + +/* Article +================================================== */ +.art { + margin-top: -131px; +} +/* Header */ +.art-header { + height: 900px; + /* Background image is defined in the post */ + background-position: top center; + background-attachment: scroll; + overflow: hidden; +} +/* Contains the time, title and subtitle for an article */ +.art-header-inner { + position: absolute; + top: 300px; + left: 50%; + margin-left: -490px; +} +.art-time, +.art-title, +.art-subtitle { + text-align: center; + text-transform: uppercase; +} +.art-time { + font-size: 14px; + line-height: 1.8; + letter-spacing: 4px; +} +.art-title { + font-size: 100px; + line-height: .9; + letter-spacing: -2px; + width: 100%; +} +.art-subtitle { + margin-top: 4px; + font-size: 14px; + line-height: 1.3; + letter-spacing: 4px; +} + +/* If small header, make few adjustments */ +.small .art-title { + font-size: 70px; + line-height: 65px; +} +.small.art-header-inner { + top: 320px; +} + +/* Body */ +.art-body { + position: relative; + width: 100%; + margin-top: 100px; + background: #fff; + z-index: 100; + -webkit-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + -moz-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + box-shadow: 0 -3px 3px rgba(0,0,0,.2); +} +.art-body-inner { + font-family: Georgia,Cambria,"Times New Roman",Times,serif; + max-width: 640px; + padding: 80px 0 50px; + letter-spacing: 0.01rem; + font-weight: 400; + font-style: normal; + font-size: 21px; + line-height: 1.5; +} +.art-body-inner a:hover { + border-bottom: 1px solid #F40034; + padding-bottom:2px; +} +.art-body-inner ul, +.art-body-inner ol { /* For lists in the article body */ + margin-bottom: 26px; +} +.art-body-inner ul li { + list-style: disc; +} + +.art-body-inner mark { + background-color: #fdffb6; + padding: 2px; + -webkit-box-shadow: #fdffb6 0 0 5px; + -moz-box-shadow: #fdffb6 0 0 5px; + box-shadow: #fdffb6 0 0 5px; +} + +.art-body-inner blockquote { + font-size: 16px; + background: #f9f9f9; + border-left: 10px solid #ccc; + margin: 1.5em 10px; + padding: 0.5em 10px; + quotes: "\201C""\201D""\2018""\2019"; +} + +.art-body-inner blockquote p:first-child:before { + color: #ccc; + content: "“"; + font-size: 4em; + line-height: 0.1em; + margin-right: 0.25em; + vertical-align: -0.4em; +} + +.art-body-inner blockquote p { + margin-bottom: 1.5em; +} + +.art-body-inner blockquote p:last-child { + margin-bottom: 0; +} + + +.dropcap { /* First character on articles */ + float: left; + margin: 47px 10px 20px 0; + font-size: 100px; + line-height: 0; +} +.art-subhead { /* Subheads are used to break up sections of an article */ + margin: 60px 0 15px; + font-size: 20px; + line-height: 28px; + letter-spacing: 3px; +} +.callout { /* Callouts are like large pullquotes */ + font-weight: bold; +} +.art-body-inner img { + max-width: 100%; + max-height: 600px; + margin-bottom: 26px; +} +.art-body-inner img.center { + display: block; + margin-left: auto; + margin-right: auto; +} +.art-body-inner .art-reference { + font-size: 80%; + color: #999; + margin-top: 50px; +} + +/* For simple, white background posts */ +.simple .art-body { + background: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + + +/* List of Articles +================================================== */ +.art-list { + padding: 120px 0 0; +} +.art-list-body { + position: relative; + overflow: hidden; +} +.art-list-item { + padding: 40px 0; + list-style: none; + overflow: hidden; + border-bottom: 1px solid #ccc; +} +.art-list-item:last-child { + border-bottom: none; +} +.art-list-title { + font-size: 26px; + line-height: 26px; + font-weight: 700; +} +.art-list-item-title-and-time { + float: left; + width: 30%; + margin-bottom: 10px; +} +.art-list-time { + font-size: 12px; + line-height: 20px; + letter-spacing: 2px; + text-transform: uppercase; + color: #999; +} +.art-list-title a { + color: #000; +} +.art-list-title a:hover { + color: #F40034; +} +.art-list-item p { + width: 65%; + float: right; + margin-left: 5%; + margin-bottom: 0; + font-size: 16px; + line-height: 24px; +} + + +/* Footer +================================================== */ +.footer { + padding: 30px 0 40px; + overflow: hidden; + border-top: 1px solid #ccc; +} +.footer, +.footer a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-size: 13px; + text-transform: uppercase; + color: #777; +} +.footer a:hover { + color: #000; +} +.back-to-top, +.footer-nav, +.offsite-links { + width: 45%; + float: left; +} +.psi { + width:10%; + float:left; + text-align: center; +} +.footer-nav { + text-align: center; +} +.offsite-links { + text-align: right; +} +.footer .twitter-link:hover { + color: #0084B4; +} +.footer .instagram-link:hover { + color: #3F729B; +} +.footer .github-link:hover { + color: #c5376d; +} +.footer .caffein8-link:hover{ + color: black; +} +.footer .rss-link:hover { + color: #e85d24; +} +/* Remove prev & next links on loop */ +.art-list + .footer .footer-nav, +.abt + .footer .footer-nav { + text-indent: -9999px; + text-align: left; +} + + +/* White Reverse Theme +================================================== */ +/* Nav */ +.nav.white { + border-bottom-color: #fff; + border-bottom-color: rgba(255,255,255,.3); +} +.nav.white li a, +.nav.white li, +.nav.white #logo h1 { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} +.nav.white #logo h1 { + background-position: top center; +} + +nav.pagination{ + text-align: right; + padding-bottom: 25px; +} +/* Art header */ +.art-header.white { + background-color: #111; +} +.art-header.white .art-time, +.art-header.white .art-title, +.art-header.white .art-subtitle { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} + + +/* About page +================================================== */ +.abt { + padding: 200px 0 100px; + list-style: none; +} +.abt .abt-header { + font-size: 140px; + line-height: 1; + text-transform: none; +} +.abt .abt-subheader { + font-size: 24px; + font-style: italic; + text-transform: none; + color: #777; +} +.abt-body { + -moz-column-count: 2; + -moz-column-gap: 20px; + -webkit-column-count: 2; + -webkit-column-gap: 20px; + margin-bottom: 28px; +} +.abt-signoff { + line-height: 1.3; + font-style: italic; + color: #777; +} + +/* 404 page +================================================== */ +.fourohfour { + padding: 240px 0 100px; + text-align: center; +} + +/* Code +================================================== */ + +code, tt { +background: #ededee; +color: #3C4043; +font-size: 90%; +padding: 1px 3px; +} + +pre { + width: 92%; + overflow: auto; + margin: 2rem 0; + padding: 1rem 0.8rem 1rem 1.2rem; + color: #3f3b36; + border: 1px solid #ccc; + border-left: 1rem solid #ccc; + font: lighter 1.2rem/2rem monospace; + background: url(/assets/img/pre.png) repeat 0 -0.9rem; + background-size: 1px 4rem; +} + +pre code, tt { +font-size: inherit; +white-space: -moz-pre-wrap; +white-space: pre-wrap; +background: transparent; +border: none; +padding: 0; +} + + +.gist { + font-size: 14px; +} + + +/* Responsive +================================================== */ +@media only screen and (max-width: 1080px) { + /* Set all of the 980 containers to flexible width */ + .nav, + .art-body-inner, + .art-header-inner, + .footer, + .art-list, + .abt, + .fourohfour { + width: 90%; + } + .nav, + .art-header-inner { + margin-left: -45%; + } +} + +@media only screen and (max-width: 1024px) { + /* Everything becomes scrolling and non-fading */ + .nav, + .nav.fixed { + position: relative; + opacity: 1 !important; /* Important to override JS values */ + display: inline-block; + } + .art-header-inner { + position: relative; + top: 0 !important; /* Important to override JS values */ + margin-top: 240px !important; /* Important to override JS values */ + opacity: 1 !important; /* Important to override JS values */ + } + /* Articles no longer have fixed heights */ + .art-header { + height: auto; + padding-bottom: 100px; + background-size: cover !important; + background-attachment: scroll; + } + /* Remove bottom space out if articles doesn't have a background */ + .simple .art-header { + padding-bottom: 0; + } + .art-list { + padding-top: 0; + } + .abt { + padding: 40px 0; + } + .fourohfour { + padding: 80px 0 60px; + } +} + +@media only screen and (max-width: 780px) { + .art-body-inner ul, + .art-body-inner ol { + margin-left: 20px; + } + .art-title { + letter-spacing: 0; + } + .art-subtitle, + .art-time { + font-size: 12px; + } + .nav { + padding-top: 25px; + height: 55px; + } + .art-list-item-title-and-time, + .art-list-item p { + float: none; + width: auto; + margin-left: 0; + } + .abt-body { + -moz-column-count: 1; + -webkit-column-count: 1; + } +} + +@media only screen and (max-width: 500px) { + .nav-primary li { + margin-left: 10px; + } + .nav #logo h1 { + font-size: 16px; + letter-spacing: -1px; + } + .nav li a { + font-size: 12px; + } + .art-header { + padding-bottom: 50px; + } + .art-header-inner { + margin-top: 190px !important; + } + .art-body-inner { + padding-top: 30px; + } + body { + font-size: 15px; + line-height: 24px; + } + p { + margin-bottom: 24px; + } + .footer { + padding: 10px 0 20px; + } + .back-to-top, + .footer-nav { + width: 50%; + } + .back-to-top { + text-align: left; + } + .footer-nav { + text-align: right; + } + .offsite-links { + float: left; + width: 100%; + text-align: left; + } + .offsite-links a { + font-size: 12px; + } + .art-list + .footer .footer-nav { + display: none; + } + .abt .abt-header { + font-size: 80px; + } + .abt .abt-subheader { + font-size: 18px; + } +} + + +/* Misc +================================================== */ +::selection { + background: #000; + color: #fff; +} +::-moz-selection { + background: #000; + color: #fff; +} +img.left { + float: left; + margin-right: 20px; +} +img.right { + float: right; + margin-left: 20px; +} +/* Clearfixing pile */ +.nav:before, +.art-body-inner:before, +.footer:before, +.art-list:before { + content:""; + display:table; +} +.nav:after, +.art-body-inner:after, +.footer:after, +.art-list:after { + clear:both; +} +.nav, +.art-body-inner, +.footer, +.art-list { + zoom:1; /* For IE 6/7 (trigger hasLayout) */ +} + + +@-webkit-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@-moz-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +.art-header-inner { + -webkit-animation: le-fade .5s 0 1 ease-out; + -moz-animation: le-fade .5s 0 1 ease-out; +} + +.art-list, +.nav, +.abt, +.art-body { + -webkit-animation: le-fade .5s 0s 1 ease-out; + -moz-animation: le-fade .5s 0s 1 ease-out; +} + +hr.featured-article { + padding: 0; + border: none; + border-top: medium double #bbb; + color: #bbb; + text-align: center; +} +hr.featured-article:after { + content: "✭ Featured Article ✭"; + display: inline-block; + position: relative; + top: -0.8em; + font-size: 1.2em; + padding: 0 0.6em; + background: white; +} + +/* FORM */ + +#contact-area { + width: 600px; + margin-top: 25px; +} + +#contact-area input, #contact-area textarea { + padding: 5px; + width: 471px; + font-family: Helvetica, sans-serif; + margin: 0px 0px 10px 0px; + border: 2px solid #ccc; +} + +#contact-area textarea { + height: 90px; +} + +#contact-area textarea:focus, #contact-area input:focus { + border: 2px solid #900; +} + +#contact-area input.submit-button { + width: 100px; + +} + +label { + float: left; + text-align: right; + margin-right: 15px; + width: 100px; + padding-top: 5px; +} \ No newline at end of file diff --git a/build/web/assets/img/favicon.ico b/build/web/assets/img/favicon.ico new file mode 100644 index 00000000..40b40ed3 Binary files /dev/null and b/build/web/assets/img/favicon.ico differ diff --git a/build/web/assets/img/pre.png b/build/web/assets/img/pre.png new file mode 100644 index 00000000..7f48517b Binary files /dev/null and b/build/web/assets/img/pre.png differ diff --git a/build/web/cookies.jsp b/build/web/cookies.jsp new file mode 100644 index 00000000..3c1dd330 --- /dev/null +++ b/build/web/cookies.jsp @@ -0,0 +1,43 @@ +<%-- + Document : cookies + Created on : Nov 24, 2014, 4:06:44 PM + Author : Teofebano +--%> + + + + +Setting Cookies + + +<% + // Create cookies for first and last names. + Cookie username = new Cookie("username",session.getAttribute("username").toString()); + Cookie password = new Cookie("password",session.getAttribute("password").toString()); + String user=session.getAttribute("username").toString(); + String role=session.getAttribute("role").toString(); + int user_id= (Integer) session.getAttribute("user_id"); + + // Set expiry date after 24 Hrs for both the cookies. + username.setMaxAge(60*3); + password.setMaxAge(60*3); + + // Add both the cookies in the response header. + response.addCookie( username ); + response.addCookie( password ); + session.setAttribute("username",user); + session.setAttribute("role",role); + session.setAttribute("user_id",user_id); + if (role == "Owner"){ + response.sendRedirect("home-owner.jsp"); + } + else if (role == "Editor"){ + response.sendRedirect("home-editor.jsp"); + } + else if (role == "Admin"){ + response.sendRedirect("home-admin.jsp"); + } + +%> + + \ No newline at end of file diff --git a/build/web/delete.jsp b/build/web/delete.jsp new file mode 100644 index 00000000..c4561d64 --- /dev/null +++ b/build/web/delete.jsp @@ -0,0 +1,57 @@ +<%-- + Document : delete + Created on : Nov 25, 2014, 3:58:23 PM + Author : Teofebano +--%> + +<%@page import="java.sql.ResultSet"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.SQLException"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + <% + Connection con = null; + String user_id= request.getParameter("user_id"); + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + try + { + String sql=("DELETE FROM user WHERE user_id='" + user_id + "'"); + PreparedStatement ps = con.prepareStatement(sql); + ps.executeUpdate(sql); + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + System.out.println("DELETE FROM user WHERE user_id=" + user_id); + + response.sendRedirect("ManagementUser.jsp"); + %> + + diff --git a/build/web/edit_post.jsp b/build/web/edit_post.jsp new file mode 100644 index 00000000..44bba3a2 --- /dev/null +++ b/build/web/edit_post.jsp @@ -0,0 +1,199 @@ +<%-- + Document : edit_post + Created on : Nov 24, 2014, 2:10:26 PM + Author : tegar +--%> + + +<%@page import="java.sql.Connection"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.ResultSet"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.SQLException"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Edit Post + + + + + +
+ + + +
+ + +

-

+ +
+
+

Edit Post

+ +
+
+ + <% + Connection con = null; + try + { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql="SELECT * FROM post WHERE post_id="+request.getParameter("post_id"); + System.out.println(sql); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(""); + out.println(""); + out.println(""); + out.println("
"); + out.println(""); + out.println(""); + out.println(""); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> + +
+
+
+
+ +
+ + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/build/web/home-admin.jsp b/build/web/home-admin.jsp new file mode 100644 index 00000000..e3596f4a --- /dev/null +++ b/build/web/home-admin.jsp @@ -0,0 +1,234 @@ +<%-- + Document : home-admin + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
+ + + +
+
+ +
+
+ + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/build/web/home-editor.jsp b/build/web/home-editor.jsp new file mode 100644 index 00000000..651af444 --- /dev/null +++ b/build/web/home-editor.jsp @@ -0,0 +1,218 @@ +<%-- + Document : home-editor + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
+ + + +
+
+ +
+
+ + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/build/web/home-owner.jsp b/build/web/home-owner.jsp new file mode 100644 index 00000000..90e7e14a --- /dev/null +++ b/build/web/home-owner.jsp @@ -0,0 +1,222 @@ +<%-- + Document : home-owner + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
+ + + +
+
+ +
+
+ + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/build/web/home.jsp b/build/web/home.jsp new file mode 100644 index 00000000..38d14965 --- /dev/null +++ b/build/web/home.jsp @@ -0,0 +1,187 @@ +<%-- + Document : LoginCheck + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
+ + + +
+
+ +
+
+ + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/build/web/index.jsp b/build/web/index.jsp new file mode 100644 index 00000000..c4fe806e --- /dev/null +++ b/build/web/index.jsp @@ -0,0 +1,172 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
+ + + +
+
+ +
+
+ + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/build/web/login.jsp b/build/web/login.jsp new file mode 100644 index 00000000..273a75d2 --- /dev/null +++ b/build/web/login.jsp @@ -0,0 +1,30 @@ +<%-- + Document : login + Created on : Nov 24, 2014, 2:07:37 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Login + + + +
+

Login Page

+

Login Details

+
+
Username : +
Password : +

+
+
+
+ Back to main page +
+ + + diff --git a/build/web/logout.jsp b/build/web/logout.jsp new file mode 100644 index 00000000..a0dfc9b5 --- /dev/null +++ b/build/web/logout.jsp @@ -0,0 +1,24 @@ +<%-- + Document : logout + Created on : Nov 24, 2014, 2:24:33 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Logout + + + <% + session.removeAttribute("username"); + session.removeAttribute("password"); + session.invalidate(); + response.sendRedirect("index.jsp"); + %> + + + + diff --git a/build/web/new_post.jsp b/build/web/new_post.jsp new file mode 100644 index 00000000..11eb55a6 --- /dev/null +++ b/build/web/new_post.jsp @@ -0,0 +1,196 @@ +<%-- + Document : new_post + Created on : Nov 24, 2014, 2:10:26 PM + Author : tegar +--%> + + + + +<%@page import="java.util.logging.Logger"%> +<%@page import="java.util.logging.Level"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Statement"%> +<%@page import="java.sql.Connection"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Tambah Post + + + + + +
+ + + +
+ + +

-

+ +
+
+

Tambah Post

+ +
+
+ + + + + + <% + System.out.println(request.getParameter("User_Id")); + //Ada user id + out.println(""); + out.println(""); + + %> + +
+ + + + + +
+
+
+
+
+ +
+ + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/build/web/picture/Artikel Dengan Gambar 1.jpg b/build/web/picture/Artikel Dengan Gambar 1.jpg new file mode 100644 index 00000000..c722133d Binary files /dev/null and b/build/web/picture/Artikel Dengan Gambar 1.jpg differ diff --git a/build/web/post.jsp b/build/web/post.jsp new file mode 100644 index 00000000..2e514fc7 --- /dev/null +++ b/build/web/post.jsp @@ -0,0 +1,381 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + Connection con2 = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con2 = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con2.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(rs.getString("judul")); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> + + + + + + +
+ + + +
+ +
+
+ +
+

+ <% + Connection con1 = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con1 = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con1.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(rs.getString("judul")); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +

+

+
+
+ +
+
+
+ <% + Connection con = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println("

" + + rs.getString("konten") + + "

"); + if (!rs.getString("picture_filename").isEmpty()) + { + out.println(""); + } + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +
+ +

Komentar

+ +
+
+ "> + "> + + <% + try + { + String sql="SELECT * FROM user WHERE user_id="+request.getParameter("user_id"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(""); + out.println(""); + out.println(""); + out.println(""); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + + %> +
+ + + +
+
+ +
+
    + <% + try + { + String sql=("SELECT * FROM komentar WHERE post_id=" + + "\'" + +request.getParameter("post_id") + + "\'" + +" ORDER BY komentar_tanggal DESC"); + /*String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id"));*/ + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + + out.println("
  • "); + out.println("
    "); + out.println("

    "); + out.println(rs.getString("komentar_nama")); + out.println("

    "); + out.println("
    "); + out.println(rs.getString("komentar_tanggal")); + out.println("
    "); + out.println("
    "); + out.println("

    "); + out.println(rs.getString("komentar_konten")); + out.println("

    "); + out.println("
  • "); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +
+
+ + +
+
+ +
+ + + +
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/build/web/showunpublishedposts.jsp b/build/web/showunpublishedposts.jsp new file mode 100644 index 00000000..57d1550e --- /dev/null +++ b/build/web/showunpublishedposts.jsp @@ -0,0 +1,204 @@ +<%-- + Document : showunpublishedposts + Created on : Nov 24, 2014, 2:10:26 PM + Author : tegar +--%> + + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
+ + + +
+
+ +
+
+ + + +
+ + + + + + + + + \ No newline at end of file diff --git a/build/web/update.jsp b/build/web/update.jsp new file mode 100644 index 00000000..2fbd1fcc --- /dev/null +++ b/build/web/update.jsp @@ -0,0 +1,65 @@ +<%-- + Document : update + Created on : Nov 25, 2014, 4:58:58 PM + Author : Teofebano +--%> + +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.SQLException"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + <% + String a=request.getParameter("username").toString(); + String b=request.getParameter("password").toString(); + String c=request.getParameter("role").toString(); + String d=request.getParameter("email").toString(); + String user_id= request.getParameter("user_id"); + + System.out.println(c); + %> + <% + Connection con = null; + + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + try + { + String sql=("UPDATE user SET role='"+c+"',nama='"+a+"', password='"+b+"', email='"+d+"' WHERE user_id='"+ user_id +"'"); + PreparedStatement ps = con.prepareStatement(sql); + ps.executeUpdate(sql); + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + + + response.sendRedirect("ManagementUser.jsp"); + %> + + diff --git a/build/web/web/LoginCheck.jsp b/build/web/web/LoginCheck.jsp new file mode 100644 index 00000000..2be071e1 --- /dev/null +++ b/build/web/web/LoginCheck.jsp @@ -0,0 +1,99 @@ +<%-- + Document : LoginCheck + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + Login Check + + + <% + String username=request.getParameter("username"); + String password=request.getParameter("password"); + String passwordS = ""; // dari SQL + String rol = ""; + int user_id = 0; + + Connection con = null; + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Retrieve password and role + try + { + String sql=("SELECT user_id, password, role FROM user WHERE nama='"+username+"'"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + + String[] pass = null; + int rl = 0; + int user = 0; + while (rs.next()){ + String em = rs.getString("password"); + rl = rs.getInt("role"); + user = rs.getInt("user_id"); + pass = em.split("\n"); + for (int i =0; i < pass.length; i++){ + System.out.println(pass[i]); + } + } + if (pass != null){ + passwordS = pass[0]; + + switch (rl){ + case 1: rol = "Owner"; break; + case 2: rol = "Editor"; break; + case 3: rol = "Admin"; break; + default : rol = "Guest"; break; + } + + user_id = user; + } + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + + if( password.equals(passwordS)) + { + session.setAttribute("username",username); + session.setAttribute("password",password); + session.setAttribute("role",rol); + session.setAttribute("user_id",user_id); + response.sendRedirect("cookies.jsp"); + } + else + response.sendRedirect("index.jsp"); + + %> + + + diff --git a/build/web/web/META-INF/context.xml b/build/web/web/META-INF/context.xml new file mode 100644 index 00000000..38bc2b4c --- /dev/null +++ b/build/web/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/build/web/web/ManagementUser.jsp b/build/web/web/ManagementUser.jsp new file mode 100644 index 00000000..90601375 --- /dev/null +++ b/build/web/web/ManagementUser.jsp @@ -0,0 +1,89 @@ +<%-- + Document : ManagementUser + Created on : Nov 24, 2014, 5:24:10 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + Management User + + + + + + + + + + + + <% + + Connection con = null; + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Retrieve password and role + try + { + String sql=("SELECT nama, password, role FROM user"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()){ + String x = rs.getString("nama"); + String y = rs.getString("password"); + int z = rs.getInt("role"); + %> + + + + + + + + + + <% + } + + rs.close(); + con.close(); + %> +
NamePasswordRoleUpdateDelete
<% out.println(x); %><% out.println(y); %><% out.println(z); %>
+ + <% + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> + + + \ No newline at end of file diff --git a/build/web/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar b/build/web/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar new file mode 100644 index 00000000..0236900b Binary files /dev/null and b/build/web/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar differ diff --git a/build/web/web/assets/css/screen.css b/build/web/web/assets/css/screen.css new file mode 100644 index 00000000..c971008e --- /dev/null +++ b/build/web/web/assets/css/screen.css @@ -0,0 +1,862 @@ +@import url(http://fonts.googleapis.com/css?family=Open+Sans); +@import url(http://fonts.googleapis.com/css?family=Questrial); + +/* Reset & Basics (Inspired by E. Meyers) +================================================== */ +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, address, cite, code, em, img, small, strong, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, embed, figure, figcaption, footer, header, hgroup, menu, nav, section, summary, time, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; } +article, aside, details, figcaption, figure, footer, header, hgroup, menu, time, nav, section { + display: block; } +html, body, .wrapper { + min-height: 100%; +} + + +/* Body +================================================== */ +html, body { + height: 100%; +} +.wrapper { + min-height: 100%; +} +body { + overflow-x: hidden; + font: 17px/28px ff-meta-serif-web-pro, "Georgia", serif; + color: #333; + background: #fff; +} + + +/* Typography +================================================== */ +h1, h2, h3, h4, h5, h6 { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: normal; + text-transform: uppercase; + font-weight: 700; + color: #000; + text-rendering: optimizeLegibility; +} + +h1 { + font-size: 50px; + padding-bottom: 30px; +} + +h2 { + font-size: 45px; + padding-bottom: 25px; +} + +h3 { + font-size: 40px; + padding-bottom: 20px; +} + +h4 { + font-size: 35px; + padding-bottom: 15px; +} + +h5 { + font-size: 30px; + padding-bottom: 10px; +} + +p { + margin: 0 0 28px 0; +} + +strong { + font-weight: bold; +} +em { + font-style: italic; +} +sup { + line-height: 0; +} + +small { + font-size: 70%; +} + +cite { + font-size: 80%; + font-style: italic; + } + +/* Teaser +================================================== */ + +header#teaser h1 { + text-transform: none !important; + color: #333; + font-size: 28px !important; + font-weight: 300 !important; +} + + +/* Links +================================================== */ +a { + color: #F40034; + text-decoration: none; + -webkit-transition: color .2s ease-in-out; + -moz-transition: color .2s ease-in-out; + transition: color .2s ease-in-out; +} +a:hover { + color: #F40034; +} + +/* Layout +================================================== */ +/* White container that is the "page" */ +.wrapper { + max-width: 1500px; + margin: 0 auto; + background: #fff; +} + +/* Containers to keep content to a set width */ +.nav, +.art-header-inner, +.footer, +.art-list, +.abt, +.fourohfour { + width: 980px; +} +.nav, +.art-body-inner, +.footer, +.art-list, +.abt, +.fourohfour { + position: relative; + margin: 0 auto; +} + +/* Nav +================================================== */ +.nav { + position: absolute; + top: 0; + left: 50%; + height: 70px; + padding-top: 40px; + margin-left: -490px; /* Half width of nav */ + border-bottom: 1px solid #333; + z-index: 2; +} +.nav.fixed { + position: fixed; +} +#logo { + float: left; +} +.nav-primary { + float: right; +} +.nav-primary li { + display: inline-block; + margin-left: 10px; + font-weight: 500; +} +#logo h1, +.nav-primary li, +.nav-primary li a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: 700; + font-size: 13px; + line-height: 30px; + color: #000; + text-transform: uppercase; +} + +#logo h1 { + height: 30px; + margin-left: 0px; + letter-spacing: 1px; + font-family: 'Questrial', sans-serif; + font-size: 30px; +} + +#logo h1 span{ + color: #F40034 !important; +} + +.nav li:first-child { + margin-left: 0; /* Remove left margin from the first nav li */ +} + +/* Home Page +================================================== */ + +div#home {} + +#home > div.cover { + max-width: 980px; + margin: 0px auto; + /*padding-top: 110px;*/ +} + +div.cover { + +} + +div.cover > img { + width: 100%; + height: 100%; +} + + +/* Article +================================================== */ +.art { + margin-top: -131px; +} +/* Header */ +.art-header { + height: 900px; + /* Background image is defined in the post */ + background-position: top center; + background-attachment: scroll; + overflow: hidden; +} +/* Contains the time, title and subtitle for an article */ +.art-header-inner { + position: absolute; + top: 300px; + left: 50%; + margin-left: -490px; +} +.art-time, +.art-title, +.art-subtitle { + text-align: center; + text-transform: uppercase; +} +.art-time { + font-size: 14px; + line-height: 1.8; + letter-spacing: 4px; +} +.art-title { + font-size: 100px; + line-height: .9; + letter-spacing: -2px; + width: 100%; +} +.art-subtitle { + margin-top: 4px; + font-size: 14px; + line-height: 1.3; + letter-spacing: 4px; +} + +/* If small header, make few adjustments */ +.small .art-title { + font-size: 70px; + line-height: 65px; +} +.small.art-header-inner { + top: 320px; +} + +/* Body */ +.art-body { + position: relative; + width: 100%; + margin-top: 100px; + background: #fff; + z-index: 100; + -webkit-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + -moz-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + box-shadow: 0 -3px 3px rgba(0,0,0,.2); +} +.art-body-inner { + font-family: Georgia,Cambria,"Times New Roman",Times,serif; + max-width: 640px; + padding: 80px 0 50px; + letter-spacing: 0.01rem; + font-weight: 400; + font-style: normal; + font-size: 21px; + line-height: 1.5; +} +.art-body-inner a:hover { + border-bottom: 1px solid #F40034; + padding-bottom:2px; +} +.art-body-inner ul, +.art-body-inner ol { /* For lists in the article body */ + margin-bottom: 26px; +} +.art-body-inner ul li { + list-style: disc; +} + +.art-body-inner mark { + background-color: #fdffb6; + padding: 2px; + -webkit-box-shadow: #fdffb6 0 0 5px; + -moz-box-shadow: #fdffb6 0 0 5px; + box-shadow: #fdffb6 0 0 5px; +} + +.art-body-inner blockquote { + font-size: 16px; + background: #f9f9f9; + border-left: 10px solid #ccc; + margin: 1.5em 10px; + padding: 0.5em 10px; + quotes: "\201C""\201D""\2018""\2019"; +} + +.art-body-inner blockquote p:first-child:before { + color: #ccc; + content: "“"; + font-size: 4em; + line-height: 0.1em; + margin-right: 0.25em; + vertical-align: -0.4em; +} + +.art-body-inner blockquote p { + margin-bottom: 1.5em; +} + +.art-body-inner blockquote p:last-child { + margin-bottom: 0; +} + + +.dropcap { /* First character on articles */ + float: left; + margin: 47px 10px 20px 0; + font-size: 100px; + line-height: 0; +} +.art-subhead { /* Subheads are used to break up sections of an article */ + margin: 60px 0 15px; + font-size: 20px; + line-height: 28px; + letter-spacing: 3px; +} +.callout { /* Callouts are like large pullquotes */ + font-weight: bold; +} +.art-body-inner img { + max-width: 100%; + max-height: 600px; + margin-bottom: 26px; +} +.art-body-inner img.center { + display: block; + margin-left: auto; + margin-right: auto; +} +.art-body-inner .art-reference { + font-size: 80%; + color: #999; + margin-top: 50px; +} + +/* For simple, white background posts */ +.simple .art-body { + background: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + + +/* List of Articles +================================================== */ +.art-list { + padding: 120px 0 0; +} +.art-list-body { + position: relative; + overflow: hidden; +} +.art-list-item { + padding: 40px 0; + list-style: none; + overflow: hidden; + border-bottom: 1px solid #ccc; +} +.art-list-item:last-child { + border-bottom: none; +} +.art-list-title { + font-size: 26px; + line-height: 26px; + font-weight: 700; +} +.art-list-item-title-and-time { + float: left; + width: 30%; + margin-bottom: 10px; +} +.art-list-time { + font-size: 12px; + line-height: 20px; + letter-spacing: 2px; + text-transform: uppercase; + color: #999; +} +.art-list-title a { + color: #000; +} +.art-list-title a:hover { + color: #F40034; +} +.art-list-item p { + width: 65%; + float: left; + margin-left: 5%; + margin-bottom: 0; + font-size: 16px; + line-height: 24px; +} + + +/* Footer +================================================== */ +.footer { + padding: 30px 0 40px; + overflow: hidden; + border-top: 1px solid #ccc; +} +.footer, +.footer a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-size: 13px; + text-transform: uppercase; + color: #777; +} +.footer a:hover { + color: #000; +} +.back-to-top, +.footer-nav, +.offsite-links { + width: 45%; + float: left; +} +.psi { + width:10%; + float:left; + text-align: center; +} +.footer-nav { + text-align: center; +} +.offsite-links { + text-align: right; +} +.footer .twitter-link:hover { + color: #0084B4; +} +.footer .instagram-link:hover { + color: #3F729B; +} +.footer .github-link:hover { + color: #c5376d; +} +.footer .caffein8-link:hover{ + color: black; +} +.footer .rss-link:hover { + color: #e85d24; +} +/* Remove prev & next links on loop */ +.art-list + .footer .footer-nav, +.abt + .footer .footer-nav { + text-indent: -9999px; + text-align: left; +} + + +/* White Reverse Theme +================================================== */ +/* Nav */ +.nav.white { + border-bottom-color: #fff; + border-bottom-color: rgba(255,255,255,.3); +} +.nav.white li a, +.nav.white li, +.nav.white #logo h1 { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} +.nav.white #logo h1 { + background-position: top center; +} + +nav.pagination{ + text-align: right; + padding-bottom: 25px; +} +/* Art header */ +.art-header.white { + background-color: #111; +} +.art-header.white .art-time, +.art-header.white .art-title, +.art-header.white .art-subtitle { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} + + +/* About page +================================================== */ +.abt { + padding: 200px 0 100px; + list-style: none; +} +.abt .abt-header { + font-size: 140px; + line-height: 1; + text-transform: none; +} +.abt .abt-subheader { + font-size: 24px; + font-style: italic; + text-transform: none; + color: #777; +} +.abt-body { + -moz-column-count: 2; + -moz-column-gap: 20px; + -webkit-column-count: 2; + -webkit-column-gap: 20px; + margin-bottom: 28px; +} +.abt-signoff { + line-height: 1.3; + font-style: italic; + color: #777; +} + +/* 404 page +================================================== */ +.fourohfour { + padding: 240px 0 100px; + text-align: center; +} + +/* Code +================================================== */ + +code, tt { +background: #ededee; +color: #3C4043; +font-size: 90%; +padding: 1px 3px; +} + +pre { + width: 92%; + overflow: auto; + margin: 2rem 0; + padding: 1rem 0.8rem 1rem 1.2rem; + color: #3f3b36; + border: 1px solid #ccc; + border-left: 1rem solid #ccc; + font: lighter 1.2rem/2rem monospace; + background: url(/assets/img/pre.png) repeat 0 -0.9rem; + background-size: 1px 4rem; +} + +pre code, tt { +font-size: inherit; +white-space: -moz-pre-wrap; +white-space: pre-wrap; +background: transparent; +border: none; +padding: 0; +} + + +.gist { + font-size: 14px; +} + + +/* Responsive +================================================== */ +@media only screen and (max-width: 1080px) { + /* Set all of the 980 containers to flexible width */ + .nav, + .art-body-inner, + .art-header-inner, + .footer, + .art-list, + .abt, + .fourohfour { + width: 90%; + } + .nav, + .art-header-inner { + margin-left: -45%; + } +} + +@media only screen and (max-width: 1024px) { + /* Everything becomes scrolling and non-fading */ + .nav, + .nav.fixed { + position: relative; + opacity: 1 !important; /* Important to override JS values */ + display: inline-block; + } + .art-header-inner { + position: relative; + top: 0 !important; /* Important to override JS values */ + margin-top: 240px !important; /* Important to override JS values */ + opacity: 1 !important; /* Important to override JS values */ + } + /* Articles no longer have fixed heights */ + .art-header { + height: auto; + padding-bottom: 100px; + background-size: cover !important; + background-attachment: scroll; + } + /* Remove bottom space out if articles doesn't have a background */ + .simple .art-header { + padding-bottom: 0; + } + .art-list { + padding-top: 0; + } + .abt { + padding: 40px 0; + } + .fourohfour { + padding: 80px 0 60px; + } +} + +@media only screen and (max-width: 780px) { + .art-body-inner ul, + .art-body-inner ol { + margin-left: 20px; + } + .art-title { + letter-spacing: 0; + } + .art-subtitle, + .art-time { + font-size: 12px; + } + .nav { + padding-top: 25px; + height: 55px; + } + .art-list-item-title-and-time, + .art-list-item p { + float: none; + width: auto; + margin-left: 0; + } + .abt-body { + -moz-column-count: 1; + -webkit-column-count: 1; + } +} + +@media only screen and (max-width: 500px) { + .nav-primary li { + margin-left: 10px; + } + .nav #logo h1 { + font-size: 16px; + letter-spacing: -1px; + } + .nav li a { + font-size: 12px; + } + .art-header { + padding-bottom: 50px; + } + .art-header-inner { + margin-top: 190px !important; + } + .art-body-inner { + padding-top: 30px; + } + body { + font-size: 15px; + line-height: 24px; + } + p { + margin-bottom: 24px; + } + .footer { + padding: 10px 0 20px; + } + .back-to-top, + .footer-nav { + width: 50%; + } + .back-to-top { + text-align: left; + } + .footer-nav { + text-align: right; + } + .offsite-links { + float: left; + width: 100%; + text-align: left; + } + .offsite-links a { + font-size: 12px; + } + .art-list + .footer .footer-nav { + display: none; + } + .abt .abt-header { + font-size: 80px; + } + .abt .abt-subheader { + font-size: 18px; + } +} + + +/* Misc +================================================== */ +::selection { + background: #000; + color: #fff; +} +::-moz-selection { + background: #000; + color: #fff; +} +img.left { + float: left; + margin-right: 20px; +} +img.right { + float: right; + margin-left: 20px; +} +/* Clearfixing pile */ +.nav:before, +.art-body-inner:before, +.footer:before, +.art-list:before { + content:""; + display:table; +} +.nav:after, +.art-body-inner:after, +.footer:after, +.art-list:after { + clear:both; +} +.nav, +.art-body-inner, +.footer, +.art-list { + zoom:1; /* For IE 6/7 (trigger hasLayout) */ +} + + +@-webkit-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@-moz-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +.art-header-inner { + -webkit-animation: le-fade .5s 0 1 ease-out; + -moz-animation: le-fade .5s 0 1 ease-out; +} + +.art-list, +.nav, +.abt, +.art-body { + -webkit-animation: le-fade .5s 0s 1 ease-out; + -moz-animation: le-fade .5s 0s 1 ease-out; +} + +hr.featured-article { + padding: 0; + border: none; + border-top: medium double #bbb; + color: #bbb; + text-align: center; +} +hr.featured-article:after { + content: "✭ Featured Article ✭"; + display: inline-block; + position: relative; + top: -0.8em; + font-size: 1.2em; + padding: 0 0.6em; + background: white; +} + +/* FORM */ + +#contact-area { + width: 600px; + margin-top: 25px; +} + +#contact-area input, #contact-area textarea { + padding: 5px; + width: 471px; + font-family: Helvetica, sans-serif; + margin: 0px 0px 10px 0px; + border: 2px solid #ccc; +} + +#contact-area textarea { + height: 90px; +} + +#contact-area textarea:focus, #contact-area input:focus { + border: 2px solid #900; +} + +#contact-area input.submit-button { + width: 100px; + +} + +label { + float: left; + text-align: right; + margin-right: 15px; + width: 100px; + padding-top: 5px; +} \ No newline at end of file diff --git a/build/web/web/assets/img/favicon.ico b/build/web/web/assets/img/favicon.ico new file mode 100644 index 00000000..40b40ed3 Binary files /dev/null and b/build/web/web/assets/img/favicon.ico differ diff --git a/build/web/web/assets/img/pre.png b/build/web/web/assets/img/pre.png new file mode 100644 index 00000000..7f48517b Binary files /dev/null and b/build/web/web/assets/img/pre.png differ diff --git a/build/web/web/cookies.jsp b/build/web/web/cookies.jsp new file mode 100644 index 00000000..5560acc2 --- /dev/null +++ b/build/web/web/cookies.jsp @@ -0,0 +1,35 @@ +<%-- + Document : cookies + Created on : Nov 24, 2014, 4:06:44 PM + Author : Paulus +--%> + + + + +Setting Cookies + + +<% + // Create cookies for first and last names. + Cookie username = new Cookie("username",session.getAttribute("username").toString()); + Cookie password = new Cookie("password",session.getAttribute("password").toString()); + String user=session.getAttribute("username").toString(); + String role=session.getAttribute("role").toString(); + int user_id= (Integer) session.getAttribute("user_id"); + + // Set expiry date after 24 Hrs for both the cookies. + username.setMaxAge(60*3); + password.setMaxAge(60*3); + + // Add both the cookies in the response header. + response.addCookie( username ); + response.addCookie( password ); + session.setAttribute("username",user); + + session.setAttribute("role",role); + session.setAttribute("user_id",user_id); + response.sendRedirect("ManagementUser.jsp"); +%> + + \ No newline at end of file diff --git a/build/web/web/edit_post.jsp b/build/web/web/edit_post.jsp new file mode 100644 index 00000000..8c957105 --- /dev/null +++ b/build/web/web/edit_post.jsp @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Edit Post + + + + + +
+ + + +
+ + +

-

+ +
+
+

Edit Post

+ +
+
+ + + + + + +
+ + + +
+
+
+
+ +
+ + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/build/web/web/home.jsp b/build/web/web/home.jsp new file mode 100644 index 00000000..4c3dcf82 --- /dev/null +++ b/build/web/web/home.jsp @@ -0,0 +1,185 @@ +<%-- + Document : LoginCheck + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
+ + + +
+
+ +
+
+ + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/build/web/web/index.jsp b/build/web/web/index.jsp new file mode 100644 index 00000000..75ed0b24 --- /dev/null +++ b/build/web/web/index.jsp @@ -0,0 +1,119 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
+ + + +
+
+ +
+
+ + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/build/web/web/login.jsp b/build/web/web/login.jsp new file mode 100644 index 00000000..4e360f9c --- /dev/null +++ b/build/web/web/login.jsp @@ -0,0 +1,25 @@ +<%-- + Document : login + Created on : Nov 24, 2014, 2:07:37 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Login + + +

Login Page

+
+

Login Details

+
+
Username: +
Password: +
+
+
+ + diff --git a/build/web/web/logout.jsp b/build/web/web/logout.jsp new file mode 100644 index 00000000..a0dfc9b5 --- /dev/null +++ b/build/web/web/logout.jsp @@ -0,0 +1,24 @@ +<%-- + Document : logout + Created on : Nov 24, 2014, 2:24:33 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Logout + + + <% + session.removeAttribute("username"); + session.removeAttribute("password"); + session.invalidate(); + response.sendRedirect("index.jsp"); + %> + + + + diff --git a/build/web/web/new_post.jsp b/build/web/web/new_post.jsp new file mode 100644 index 00000000..a5315e32 --- /dev/null +++ b/build/web/web/new_post.jsp @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Tambah Post + + + + + +
+ + + +
+ + +

-

+ +
+
+

Tambah Post

+ +
+
+ + + + + + +
+ + + +
+
+
+
+ +
+ + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/build/web/web/post.jsp b/build/web/web/post.jsp new file mode 100644 index 00000000..00c58864 --- /dev/null +++ b/build/web/web/post.jsp @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Apa itu Simple Blog? + + + + + +
+ + + +
+ +
+
+ +
+

Apa itu Simple Blog?

+

+
+
+ +
+
+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis aliquam minus consequuntur amet nulla eius, neque beatae, nostrum possimus, officiis eaque consectetur. Sequi sunt maiores dolore, illum quidem eos explicabo! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam consequuntur consequatur molestiae saepe sed, incidunt sunt inventore minima voluptatum adipisci hic, est ipsa iste. Nobis, aperiam provident quae. Reprehenderit, iste.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Asperiores animi tenetur nam delectus eveniet iste non culpa laborum provident minima numquam excepturi rem commodi, officia accusamus eos voluptates obcaecati. Possimus?

+ +
+ +

Komentar

+ +
+
+ + + + + + +
+ + + +
+
+ +
    +
  • +
    +

    Jems

    +
    2 menit lalu
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt! …

    +
  • + +
  • +
    +

    Kave

    +
    1 jam lalu
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt! …

    +
  • +
+
+
+ +
+ + + +
+ + + + + + + + \ No newline at end of file diff --git a/dist/IF3110-02-Simple-Blog-Java.war b/dist/IF3110-02-Simple-Blog-Java.war new file mode 100644 index 00000000..cfe26650 Binary files /dev/null and b/dist/IF3110-02-Simple-Blog-Java.war differ diff --git a/index.html b/index.jsp similarity index 80% rename from index.html rename to index.jsp index 07cff0ba..ca7eedfd 100644 --- a/index.html +++ b/index.jsp @@ -38,9 +38,9 @@
@@ -50,19 +50,20 @@
  • -

    Apa itu Simple Blog?

    +

    Apa itu Simple Blog?

    15 Juli 2014
    Featured
    -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt! …

    - Edit | Hapus + Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veritatis, corporis, culpa! Incidunt cupiditate sint laboriosam saepe minima id ullam ducimus eligendi dicta, in quidem, vitae blanditiis dolorum ad! Nihil, sit. +

    + Edit | Hapus

  • Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt! …

    @@ -110,5 +111,18 @@

    Siapa dibalik Simple Blog? + + \ No newline at end of file diff --git a/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar new file mode 100644 index 00000000..14c3bbbf Binary files /dev/null and b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar differ diff --git a/lib/javaee-endorsed-api-6.0/javaee-doc-api.jar b/lib/javaee-endorsed-api-6.0/javaee-doc-api.jar new file mode 100644 index 00000000..bdebe91c Binary files /dev/null and b/lib/javaee-endorsed-api-6.0/javaee-doc-api.jar differ diff --git a/lib/javaee-endorsed-api-6.0/javax.annotation.jar b/lib/javaee-endorsed-api-6.0/javax.annotation.jar new file mode 100644 index 00000000..ec4b3723 Binary files /dev/null and b/lib/javaee-endorsed-api-6.0/javax.annotation.jar differ diff --git a/lib/javaee-endorsed-api-6.0/jaxb-api-osgi.jar b/lib/javaee-endorsed-api-6.0/jaxb-api-osgi.jar new file mode 100644 index 00000000..d167e2f6 Binary files /dev/null and b/lib/javaee-endorsed-api-6.0/jaxb-api-osgi.jar differ diff --git a/lib/javaee-endorsed-api-6.0/webservices-api-osgi.jar b/lib/javaee-endorsed-api-6.0/webservices-api-osgi.jar new file mode 100644 index 00000000..217424da Binary files /dev/null and b/lib/javaee-endorsed-api-6.0/webservices-api-osgi.jar differ diff --git a/lib/mysql-connector-java-5.1.34-bin.jar b/lib/mysql-connector-java-5.1.34-bin.jar new file mode 100644 index 00000000..0236900b Binary files /dev/null and b/lib/mysql-connector-java-5.1.34-bin.jar differ diff --git a/lib/nblibraries.properties b/lib/nblibraries.properties new file mode 100644 index 00000000..d9714fb2 --- /dev/null +++ b/lib/nblibraries.properties @@ -0,0 +1,11 @@ +libs.CopyLibs.classpath=\ + ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar +libs.CopyLibs.displayName=CopyLibs Task +libs.CopyLibs.prop-version=2.0 +libs.javaee-endorsed-api-6.0.classpath=\ + ${base}/javaee-endorsed-api-6.0/javax.annotation.jar;\ + ${base}/javaee-endorsed-api-6.0/jaxb-api-osgi.jar;\ + ${base}/javaee-endorsed-api-6.0/webservices-api-osgi.jar +libs.javaee-endorsed-api-6.0.displayName=Java EE 6 Endorsed API Library +libs.javaee-endorsed-api-6.0.javadoc=\ + ${base}/javaee-endorsed-api-6.0/javaee-doc-api.jar diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml new file mode 100644 index 00000000..9bc5adf7 --- /dev/null +++ b/nbproject/ant-deploy.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 00000000..e6d398b6 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1469 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 00000000..f915e891 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=cd679818 +build.xml.script.CRC32=a9410f96 +build.xml.stylesheet.CRC32=651128d4@1.65.1.1 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=cd679818 +nbproject/build-impl.xml.script.CRC32=9fb7b8d2 +nbproject/build-impl.xml.stylesheet.CRC32=d659eb7a@1.65.1.1 diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties new file mode 100644 index 00000000..55a37038 --- /dev/null +++ b/nbproject/private/private.properties @@ -0,0 +1,5 @@ +deploy.ant.properties.file=C:\\Users\\toshibapc\\AppData\\Roaming\\NetBeans\\7.4\\tomcat70.properties +j2ee.server.home=C:/xampp/tomcat +j2ee.server.instance=tomcat70:home=C:\\xampp\\tomcat +selected.browser=Chrome +user.properties.file=C:\\Users\\toshibapc\\AppData\\Roaming\\NetBeans\\7.4\\build.properties diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml new file mode 100644 index 00000000..6807a2ba --- /dev/null +++ b/nbproject/private/private.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 00000000..052e9ddf --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,86 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +# Files to be excluded from distribution war +dist.archive.excludes= +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath=\ + ${libs.javaee-endorsed-api-6.0.classpath} +excludes= +file.reference.mysql-connector-java-5.1.34-bin.jar=web\\WEB-INF\\lib\\mysql-connector-java-5.1.34-bin.jar +includes=** +j2ee.compile.on.save=true +j2ee.copy.static.files.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.6-web +j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.2.2.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-util.jar +j2ee.server.type=Tomcat +jar.compress=false +javac.classpath=\ + ${file.reference.mysql-connector-java-5.1.34-bin.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.6 +javac.target=1.6 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +lib.dir=${web.docbase.dir}/WEB-INF/lib +no.dependencies=false +persistence.xml.dir=${conf.dir} +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional= +war.ear.name=${war.name} +war.name=IF3110-02-Simple-Blog-Java.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 00000000..286a0b76 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,26 @@ + + + org.netbeans.modules.web.project + + + IF3110-02-Simple-Blog-Java + 1.6.5 + + + ${file.reference.mysql-connector-java-5.1.34-bin.jar} + WEB-INF/lib + + + + + + + + + + + + C:\Users\toshibapc\Documents\NetBeansProjects\lib\nblibraries.properties + + + diff --git a/new_post.jsp b/new_post.jsp new file mode 100644 index 00000000..a5315e32 --- /dev/null +++ b/new_post.jsp @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Tambah Post + + + + + +
    + + + +
    + + +

    -

    + +
    +
    +

    Tambah Post

    + +
    +
    + + + + + + +
    + + + +
    +
    +
    +
    + +
    + + + +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/post.jsp b/post.jsp new file mode 100644 index 00000000..e3fe594c --- /dev/null +++ b/post.jsp @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Apa itu Simple Blog? + + + + + +
    + + + +
    + +
    +
    + +

    Apa itu Simple Blog?

    +

    +
    +
    + +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis aliquam minus consequuntur amet nulla eius, neque beatae, nostrum possimus, officiis eaque consectetur. Sequi sunt maiores dolore, illum quidem eos explicabo! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam consequuntur consequatur molestiae saepe sed, incidunt sunt inventore minima voluptatum adipisci hic, est ipsa iste. Nobis, aperiam provident quae. Reprehenderit, iste.

    +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Asperiores animi tenetur nam delectus eveniet iste non culpa laborum provident minima numquam excepturi rem commodi, officia accusamus eos voluptates obcaecati. Possimus?

    + +
    + +

    Komentar

    + +
    +
    + + + + + + +
    + + + +
    +
    + +
      +
    • +
      +

      Jems

      +
      2 menit lalu
      +
      +

      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt! …

      +
    • + +
    • +
      +

      Kave

      +
      1 jam lalu
      +
      +

      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt! …

      +
    • +
    +
    +
    + +
    + + + +
    + + + + + + + + \ No newline at end of file diff --git a/sqldump/simpleblog_withjava.sql b/sqldump/simpleblog_withjava.sql new file mode 100644 index 00000000..d7ee34f6 --- /dev/null +++ b/sqldump/simpleblog_withjava.sql @@ -0,0 +1,109 @@ +-- phpMyAdmin SQL Dump +-- version 4.0.4.1 +-- http://www.phpmyadmin.net +-- +-- Inang: 127.0.0.1 +-- Waktu pembuatan: 24 Nov 2014 pada 07.23 +-- Versi Server: 5.5.32 +-- Versi PHP: 5.4.16 + +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: `simpleblog_withjava` +-- +CREATE DATABASE IF NOT EXISTS `simpleblog_withjava` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; +USE `simpleblog_withjava`; + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `komentar` +-- + +CREATE TABLE IF NOT EXISTS `komentar` ( + `komentar_id` int(11) NOT NULL AUTO_INCREMENT, + `post_id` int(11) NOT NULL, + `komentar_nama` varchar(50) NOT NULL, + `komentar_email` varchar(50) NOT NULL, + `komentar_konten` text NOT NULL, + `komentar_tanggal` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`komentar_id`), + KEY `komentar_post` (`post_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `post` +-- + +CREATE TABLE IF NOT EXISTS `post` ( + `post_id` int(11) NOT NULL AUTO_INCREMENT, + `tanggal` date NOT NULL, + `konten` text NOT NULL, + `user_id` int(11) NOT NULL, + `status_publish` int(11) NOT NULL, + `judul` varchar(50) NOT NULL, + PRIMARY KEY (`post_id`), + UNIQUE KEY `post_id` (`post_id`), + KEY `user_posts` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; + +-- +-- Dumping data untuk tabel `post` +-- + +INSERT INTO `post` (`post_id`, `tanggal`, `konten`, `user_id`, `status_publish`, `judul`) VALUES +(1, '2014-11-26', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis aliquam minus consequuntur amet nulla eius, neque beatae, nostrum possimus, officiis eaque consectetur. Sequi sunt maiores dolore, illum quidem eos explicabo! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam consequuntur consequatur molestiae saepe sed, incidunt sunt inventore minima voluptatum adipisci hic, est ipsa iste. Nobis, aperiam provident quae. Reprehenderit, iste.\r\n\r\nLorem ipsum dolor sit amet, consectetur adipisicing elit. Asperiores animi tenetur nam delectus eveniet iste non culpa laborum provident minima numquam excepturi rem commodi, officia accusamus eos voluptates obcaecati. Possimus?', 1, 1, 'Artikel 1'), +(2, '2014-11-29', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis aliquam minus consequuntur amet nulla eius, neque beatae, nostrum possimus, officiis eaque consectetur. Sequi sunt maiores dolore, illum quidem eos explicabo! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam consequuntur consequatur molestiae saepe sed, incidunt sunt inventore minima voluptatum adipisci hic, est ipsa iste. Nobis, aperiam provident quae. Reprehenderit, iste.\r\n\r\nLorem ipsum dolor sit amet, consectetur adipisicing elit. Asperiores animi tenetur nam delectus eveniet iste non culpa laborum provident minima numquam excepturi rem commodi, officia accusamus eos voluptates obcaecati. Possimus?', 1, 1, 'Artikel 2'); + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `user` +-- + +CREATE TABLE IF NOT EXISTS `user` ( + `user_id` int(11) NOT NULL AUTO_INCREMENT, + `role` int(11) NOT NULL, + `nama` varchar(30) NOT NULL, + `password` varchar(50) NOT NULL, + `email` varchar(50) NOT NULL, + PRIMARY KEY (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; + +-- +-- Dumping data untuk tabel `user` +-- + +INSERT INTO `user` (`user_id`, `role`, `nama`, `password`, `email`) VALUES +(1, 3, 'adminganteng', 'adminganteng', ''), +(2, 1, 'ownerganteng', 'ownerganteng', ''); + +-- +-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables) +-- + +-- +-- Ketidakleluasaan untuk tabel `komentar` +-- +ALTER TABLE `komentar` + ADD CONSTRAINT `komentar_post` FOREIGN KEY (`post_id`) REFERENCES `post` (`post_id`); + +-- +-- Ketidakleluasaan untuk tabel `post` +-- +ALTER TABLE `post` + ADD CONSTRAINT `user_posts` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/src/java/com/tegar/databasehandler/AddCommentHandling.java b/src/java/com/tegar/databasehandler/AddCommentHandling.java new file mode 100644 index 00000000..5135f4df --- /dev/null +++ b/src/java/com/tegar/databasehandler/AddCommentHandling.java @@ -0,0 +1,193 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package com.tegar.databasehandler; + +import java.io.IOException; +import java.io.PrintWriter; +import java.sql.Connection; +import java.sql.DriverManager; +import static java.sql.DriverManager.println; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author Dell + */ +@WebServlet(name = "AddCommentHandling", urlPatterns = {"/AddCommentHandling"}) +public class AddCommentHandling extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + PrintWriter out = response.getWriter(); + try { + // JDBC driver name and database URL + String JDBC_DRIVER="com.mysql.jdbc.Driver"; + String DB_URL="jdbc:mysql://localhost/simpleblog_withjava"; + // Database credentials + String USER = "root"; + String PASS = ""; + // Register JDBC driver + Class.forName("com.mysql.jdbc.Driver"); + Connection conn = null; + Statement stmt = null; + // Open a connection + conn = DriverManager.getConnection(DB_URL,USER,PASS); + + // Execute SQL query + stmt = conn.createStatement(); + String sql,sql2; + /*java.util.Calendar cal = java.util.Calendar.getInstance(); + java.util.Date utilDate = cal.getTime(); + java.sql.Date sqlDate = new Date(utilDate.getTime());*/ + java.util.Date utilDate1 = new java.util.Date(); + java.sql.Date sqlDate = new java.sql.Date(utilDate1.getTime()); + sql = "INSERT INTO komentar (post_id, komentar_nama, komentar_email, komentar_konten) VALUES (" + + request.getParameter("post_id") + + "," + + "\'" + + request.getParameter("Nama") + + "\'" + + "," + + "\'" + + request.getParameter("Email") + + "\'" + + "," + + "\'" + + request.getParameter("Komentar") + + "\')" + ; + System.out.println(sql); + stmt.executeUpdate(sql); + /*String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site);*/ + if (request.getParameter("user_id").isEmpty()) + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/PostGuest.jsp?post_id=" + + request.getParameter("post_id") + + ""); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + else + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/post.jsp?" + + "user_id=" + + request.getParameter("user_id") + + "&" + + "post_id=" + + request.getParameter("post_id") + + ""); + System.out.println(site); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + +// sql = "SELECT * FROM komentar WHERE post_id='" + request.getParameter("post_id") + "'"; +// PreparedStatement ps = conn.prepareStatement(sql); +// ResultSet rs = ps.executeQuery(); +// while (rs.next()) +// { +// out.println("
  • "); +// out.println("
    "); +// out.println("

    "); +// out.println(rs.getString("komentar_nama")); +// out.println("

    "); +// out.println("
    "); +// out.println(rs.getString("komentar_tanggal")); +// out.println("
    "); +// out.println("
    "); +// out.println("

    "); +// out.println(rs.getString("komentar_konten")); +// out.println("

    "); +// out.println("
  • "); +// } +// + /* TODO output your page here. You may use following sample code. + out.println(""); + out.println(""); + out.println(""); + out.println("Servlet AddCommentHandling"); + out.println(""); + out.println(""); + out.println("

    Servlet AddCommentHandling at " + request.getContextPath() + "

    "); + out.println(""); + out.println("");*/ + } catch (SQLException ex) { + out.println("SQLEX : " + ex.getMessage()); + Logger.getLogger(AddCommentHandling.class.getName()).log(Level.SEVERE, null, ex); + } catch (ClassNotFoundException ex) { + out.println("CNFEX : " + ex.getMessage()); + Logger.getLogger(AddCommentHandling.class.getName()).log(Level.SEVERE, null, ex); + } finally { + out.close(); + } + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/src/java/com/tegar/databasehandler/AddPostHandling.java b/src/java/com/tegar/databasehandler/AddPostHandling.java new file mode 100644 index 00000000..b4549eba --- /dev/null +++ b/src/java/com/tegar/databasehandler/AddPostHandling.java @@ -0,0 +1,178 @@ +/*3 + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package com.tegar.databasehandler; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.lang.reflect.Array; +import java.sql.Connection; +import java.sql.DriverManager; +import static java.sql.DriverManager.println; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Collection; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +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; + +/** + * + * @author tegar + */ +@WebServlet("/upload") +@MultipartConfig + +public class AddPostHandling extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + * @throws java.sql.SQLException + */ + + + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException, SQLException { + InputStream inputStream = null; // input stream of the upload file + Part filePart = request.getPart("file"); + inputStream = filePart.getInputStream(); + byte[] buffer = new byte[inputStream.available()]; + inputStream.read(buffer); + String Filename = request.getParameter("Judul")+" "+request.getParameter("User_Id"); + String PicturePath = "C:\\Users\\toshibapc\\Documents\\NetBeansProjects\\IF3110-02-Simple-Blog-Java\\web\\picture"+Filename+".jpg"; + File targetFile = new File(PicturePath); + OutputStream outStream = new FileOutputStream(targetFile); + outStream.write(buffer); + outStream.close(); + response.setContentType("text/html;charset=UTF-8"); + PrintWriter out = response.getWriter(); + try { + // JDBC driver name and database URL + String JDBC_DRIVER="com.mysql.jdbc.Driver"; + String DB_URL="jdbc:mysql://localhost/simpleblog_withjava"; + // Database credentials + String USER = "root"; + String PASS = ""; + // Register JDBC driver + Class.forName("com.mysql.jdbc.Driver"); + Connection conn = null; + Statement stmt = null; + // Open a connection + conn = DriverManager.getConnection(DB_URL,USER,PASS); + + // Execute SQL query + stmt = conn.createStatement(); + String sql; + sql = "INSERT INTO post (konten, user_id, status_publish, judul, tanggal, picture_filename) VALUES (" + + "\'" + + request.getParameter("Konten") + + "\'" + + "," + + request.getParameter("User_Id") + + "," + + "0" //status_publish + + "," + + "\'" + + request.getParameter("Judul") + + "\'" + + "," + + "\'" + + request.getParameter("Tanggal") + + "\'" + + "," + + "\'" + + Filename + + "\'" + + ")"; +// System.out.println(sql); + stmt.executeUpdate(sql); + System.out.println("Role "+request.getParameter("Role")); + if ("1".equals(request.getParameter("Role"))) + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-owner.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + else + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-admin.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + } catch (ClassNotFoundException ex) { + Logger.getLogger(AddPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } finally { + out.close(); + } + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try { + processRequest(request, response); + } catch (SQLException ex) { + Logger.getLogger(AddPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try { + processRequest(request, response); + } catch (SQLException ex) { + Logger.getLogger(AddPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + + +} diff --git a/src/java/com/tegar/databasehandler/DatabaseHandler.java b/src/java/com/tegar/databasehandler/DatabaseHandler.java new file mode 100644 index 00000000..7277db60 --- /dev/null +++ b/src/java/com/tegar/databasehandler/DatabaseHandler.java @@ -0,0 +1,75 @@ +package com.tegar.databasehandler; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +public class DatabaseHandler +{ + public Connection conn; + public DatabaseHandler() + { + try + { + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + conn = DriverManager.getConnection(url, user, password); + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + } + public ResultSet GetPostFromDatabase() + { + Statement stmt = null; + ResultSet rs = null; + List Posts = new ArrayList(); + try + { + stmt = conn.createStatement(); + rs = stmt.executeQuery("SELECT konten FROM post"); + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + finally + { + if (rs != null) + { + try + { + rs.close(); + } catch (SQLException sqlEx) { } // ignore + + rs = null; + } + + if (stmt != null) + { + try + { + stmt.close(); + } + catch (SQLException sqlEx) { } // ignore + + stmt = null; + } + } + return rs; + } +} \ No newline at end of file diff --git a/src/java/com/tegar/databasehandler/DeletePostHandling.java b/src/java/com/tegar/databasehandler/DeletePostHandling.java new file mode 100644 index 00000000..fe90e082 --- /dev/null +++ b/src/java/com/tegar/databasehandler/DeletePostHandling.java @@ -0,0 +1,156 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.tegar.databasehandler; + +import java.io.IOException; +import java.io.PrintWriter; +import java.sql.Connection; +import java.sql.DriverManager; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author Dell + */ +@WebServlet(name = "DeletePostHandling", urlPatterns = {"/DeletePostHandling"}) +public class DeletePostHandling extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException, SQLException { + response.setContentType("text/html;charset=UTF-8"); + PrintWriter out = response.getWriter(); + try { + // JDBC driver name and database URL + String JDBC_DRIVER="com.mysql.jdbc.Driver"; + String DB_URL="jdbc:mysql://localhost/simpleblog_withjava"; + // Database credentials + String USER = "root"; + String PASS = ""; + // Register JDBC driver + Class.forName("com.mysql.jdbc.Driver"); + Connection conn = null; + Statement stmt = null; + // Open a connection + conn = DriverManager.getConnection(DB_URL,USER,PASS); + + // Execute SQL query + stmt = conn.createStatement(); + String sql; + sql = "UPDATE post SET status_publish = 2 WHERE `post_id`=" + + "\'" + + request.getParameter("post_id") + + "\'"; + + /*sql = "DELETE FROM post WHERE `post_id`= " + + "\'" + + request.getParameter("post_id") + + "\'";*/ + /* TODO output your page here. You may use following sample code. + out.println(""); + out.println(""); + out.println(""); + out.println("Servlet DeletePostHandling"); + out.println(""); + out.println(""); + out.println("

    Servlet DeletePostHandling at " + request.getContextPath() + "

    "); + out.println(""); + out.println("");*/ + stmt.executeUpdate(sql); + if ("1".equals(request.getParameter("role"))) + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-owner.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + + } + else if ("2".equals(request.getParameter("role"))) + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-editor.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + else + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-admin.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + } catch (ClassNotFoundException ex) { + Logger.getLogger(AddPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } finally { + out.close(); + } + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try { + processRequest(request, response); + } catch (SQLException ex) { + Logger.getLogger(DeletePostHandling.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try { + processRequest(request, response); + } catch (SQLException ex) { + Logger.getLogger(DeletePostHandling.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/src/java/com/tegar/databasehandler/EditPostHandling.java b/src/java/com/tegar/databasehandler/EditPostHandling.java new file mode 100644 index 00000000..c17b94cc --- /dev/null +++ b/src/java/com/tegar/databasehandler/EditPostHandling.java @@ -0,0 +1,145 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package com.tegar.databasehandler; + +import java.io.IOException; +import java.io.PrintWriter; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author tegar + */ +@WebServlet(name = "EditPostHandling", urlPatterns = {"/EditPostHandling"}) +public class EditPostHandling extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException, SQLException, ClassNotFoundException { + response.setContentType("text/html;charset=UTF-8"); + PrintWriter out = response.getWriter(); + try { + // JDBC driver name and database URL + String JDBC_DRIVER="com.mysql.jdbc.Driver"; + String DB_URL="jdbc:mysql://localhost/simpleblog_withjava"; + // Database credentials + String USER = "root"; + String PASS = ""; + // Register JDBC driver + Class.forName("com.mysql.jdbc.Driver"); + Connection conn = null; + Statement stmt = null; + // Open a connection + conn = DriverManager.getConnection(DB_URL,USER,PASS); + + // Execute SQL query + stmt = conn.createStatement(); + String sql = "UPDATE post SET " + + "judul=\"" + + request.getParameter("Judul") + + "\",tanggal=\"" + + request.getParameter("Tanggal") + + "\",konten=\"" + + request.getParameter("Konten") + + "\" WHERE post_id=" + + request.getParameter("Post_Id"); + System.out.println(sql); + stmt.executeUpdate(sql); + if ("1".equals(request.getParameter("Role"))) + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-owner.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + + } + else if ("2".equals(request.getParameter("Role"))) + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-editor.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + else + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-admin.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + } finally { + out.close(); + } + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try { + processRequest(request, response); + } catch (SQLException ex) { + Logger.getLogger(EditPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } catch (ClassNotFoundException ex) { + Logger.getLogger(EditPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try { + processRequest(request, response); + } catch (SQLException ex) { + Logger.getLogger(EditPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } catch (ClassNotFoundException ex) { + Logger.getLogger(EditPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/src/java/com/tegar/databasehandler/PublishPostHandling.java b/src/java/com/tegar/databasehandler/PublishPostHandling.java new file mode 100644 index 00000000..8960b3ac --- /dev/null +++ b/src/java/com/tegar/databasehandler/PublishPostHandling.java @@ -0,0 +1,129 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package com.tegar.databasehandler; + +import java.io.IOException; +import java.io.PrintWriter; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author tegar + */ +@WebServlet(name = "PublishPostHandling", urlPatterns = {"/PublishPostHandling"}) +public class PublishPostHandling extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException, SQLException { + response.setContentType("text/html;charset=UTF-8"); + PrintWriter out = response.getWriter(); + try { + // JDBC driver name and database URL + String JDBC_DRIVER="com.mysql.jdbc.Driver"; + String DB_URL="jdbc:mysql://localhost/simpleblog_withjava"; + // Database credentials + String USER = "root"; + String PASS = ""; + // Register JDBC driver + Class.forName("com.mysql.jdbc.Driver"); + Connection conn = null; + Statement stmt = null; + // Open a connection + conn = DriverManager.getConnection(DB_URL,USER,PASS); + + // Execute SQL query + stmt = conn.createStatement(); + String sql; + sql = "UPDATE post SET status_publish=1 WHERE post_id="+request.getParameter("Post_Id"); + System.out.println(sql); + stmt.executeUpdate(sql); + if ("Editor".equals(request.getParameter("Role"))) + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-editor.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + else + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-admin.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + } catch (ClassNotFoundException ex) { + Logger.getLogger(AddPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } finally { + out.close(); + } + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try { + processRequest(request, response); + } catch (SQLException ex) { + Logger.getLogger(PublishPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try { + processRequest(request, response); + } catch (SQLException ex) { + Logger.getLogger(PublishPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/src/java/com/tegar/databasehandler/RestorePostHandling.java b/src/java/com/tegar/databasehandler/RestorePostHandling.java new file mode 100644 index 00000000..7ef42421 --- /dev/null +++ b/src/java/com/tegar/databasehandler/RestorePostHandling.java @@ -0,0 +1,156 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.tegar.databasehandler; + +import java.io.IOException; +import java.io.PrintWriter; +import java.sql.Connection; +import java.sql.DriverManager; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author Dell + */ +@WebServlet(name = "RestorePostHandling", urlPatterns = {"/RestorePostHandling"}) +public class RestorePostHandling extends HttpServlet { + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException, SQLException { + response.setContentType("text/html;charset=UTF-8"); + PrintWriter out = response.getWriter(); + try { + // JDBC driver name and database URL + String JDBC_DRIVER="com.mysql.jdbc.Driver"; + String DB_URL="jdbc:mysql://localhost/simpleblog_withjava"; + // Database credentials + String USER = "root"; + String PASS = ""; + // Register JDBC driver + Class.forName("com.mysql.jdbc.Driver"); + Connection conn = null; + Statement stmt = null; + // Open a connection + conn = DriverManager.getConnection(DB_URL,USER,PASS); + + // Execute SQL query + stmt = conn.createStatement(); + String sql; + sql = "UPDATE post SET status_publish = 1 WHERE `post_id`=" + + "\'" + + request.getParameter("post_id") + + "\'"; + + /*sql = "DELETE FROM post WHERE `post_id`= " + + "\'" + + request.getParameter("post_id") + + "\'";*/ + /* TODO output your page here. You may use following sample code. + out.println(""); + out.println(""); + out.println(""); + out.println("Servlet DeletePostHandling"); + out.println(""); + out.println(""); + out.println("

    Servlet DeletePostHandling at " + request.getContextPath() + "

    "); + out.println(""); + out.println("");*/ + stmt.executeUpdate(sql); + if ("1".equals(request.getParameter("role"))) + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-owner.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + + } + else if ("2".equals(request.getParameter("role"))) + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-editor.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + else + { + String site = new String("http://localhost:8080/IF3110-02-Simple-Blog-Java%202/home-admin.jsp"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + } + } catch (ClassNotFoundException ex) { + Logger.getLogger(AddPostHandling.class.getName()).log(Level.SEVERE, null, ex); + } finally { + out.close(); + } + } + + // + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try { + processRequest(request, response); + } catch (SQLException ex) { + Logger.getLogger(DeletePostHandling.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + try { + processRequest(request, response); + } catch (SQLException ex) { + Logger.getLogger(DeletePostHandling.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// + +} diff --git a/src/java/com/tegar/databasehandler/package-info.java b/src/java/com/tegar/databasehandler/package-info.java new file mode 100644 index 00000000..470c264c --- /dev/null +++ b/src/java/com/tegar/databasehandler/package-info.java @@ -0,0 +1,8 @@ +/** + * + */ +/** + * @author tegar + * + */ +package com.tegar.databasehandler; \ No newline at end of file diff --git a/web/AddForm.jsp b/web/AddForm.jsp new file mode 100644 index 00000000..28d5a3c9 --- /dev/null +++ b/web/AddForm.jsp @@ -0,0 +1,27 @@ +<%-- + Document : add + Created on : Nov 25, 2014, 6:30:47 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + +

    User Details

    +
    +
    Username : +
    Password : +
    Role : +
    Email : +

    +
    +
    +
    + Back to main page + + diff --git a/web/LoginCheck.jsp b/web/LoginCheck.jsp new file mode 100644 index 00000000..2be071e1 --- /dev/null +++ b/web/LoginCheck.jsp @@ -0,0 +1,99 @@ +<%-- + Document : LoginCheck + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + Login Check + + + <% + String username=request.getParameter("username"); + String password=request.getParameter("password"); + String passwordS = ""; // dari SQL + String rol = ""; + int user_id = 0; + + Connection con = null; + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Retrieve password and role + try + { + String sql=("SELECT user_id, password, role FROM user WHERE nama='"+username+"'"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + + String[] pass = null; + int rl = 0; + int user = 0; + while (rs.next()){ + String em = rs.getString("password"); + rl = rs.getInt("role"); + user = rs.getInt("user_id"); + pass = em.split("\n"); + for (int i =0; i < pass.length; i++){ + System.out.println(pass[i]); + } + } + if (pass != null){ + passwordS = pass[0]; + + switch (rl){ + case 1: rol = "Owner"; break; + case 2: rol = "Editor"; break; + case 3: rol = "Admin"; break; + default : rol = "Guest"; break; + } + + user_id = user; + } + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + + if( password.equals(passwordS)) + { + session.setAttribute("username",username); + session.setAttribute("password",password); + session.setAttribute("role",rol); + session.setAttribute("user_id",user_id); + response.sendRedirect("cookies.jsp"); + } + else + response.sendRedirect("index.jsp"); + + %> + + + diff --git a/web/META-INF/context.xml b/web/META-INF/context.xml new file mode 100644 index 00000000..38bc2b4c --- /dev/null +++ b/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/web/ManagementUser.jsp b/web/ManagementUser.jsp new file mode 100644 index 00000000..9812880e --- /dev/null +++ b/web/ManagementUser.jsp @@ -0,0 +1,107 @@ +<%-- + Document : ManagementUser + Created on : Nov 24, 2014, 5:24:10 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + Management User + + + + + + + + + + + + + <% + + Connection con = null; + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Retrieve password and role + try + { + String sql=("SELECT user_id, nama, password, role, email FROM user"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + + while (rs.next()){ + String x = rs.getString("nama"); + String y = rs.getString("password"); + String email = rs.getString("email"); + int z = rs.getInt("role"); + int user_id = rs.getInt("user_id"); + %> + + + + + + + + + + + + <% + + } + + rs.close(); + con.close(); + %> +
    NamePasswordRoleEmailUpdateDelete
    <% out.println(x); %><% out.println(y); %><% out.println(z); %><% out.println(email); %>
    + + <% + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +
    +
    +
    +
    + Back to main page + + + \ No newline at end of file diff --git a/web/PostGuest.jsp b/web/PostGuest.jsp new file mode 100644 index 00000000..c0e51c8a --- /dev/null +++ b/web/PostGuest.jsp @@ -0,0 +1,356 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + Connection con2 = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con2 = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con2.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(rs.getString("judul")); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> + + + + + + +
    + + + +
    + +
    +
    + +
    +

    + <% + Connection con1 = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con1 = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con1.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(rs.getString("judul")); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +

    +

    +
    +
    + +
    +
    +
    + <% + Connection con = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println("

    " + + rs.getString("konten") + + "

    "); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +
    + +

    Komentar

    + +
    +
    + + "> + + + + + + + +
    + + + +
    +
    + +
    +
      + <% + try + { + String sql=("SELECT * FROM komentar WHERE post_id=" + + "\'" + +request.getParameter("post_id") + + "\'" + +" ORDER BY komentar_tanggal DESC"); + /*String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id"));*/ + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + + out.println("
    • "); + out.println("
      "); + out.println("

      "); + out.println(rs.getString("komentar_nama")); + out.println("

      "); + out.println("
      "); + out.println(rs.getString("komentar_tanggal")); + out.println("
      "); + out.println("
      "); + out.println("

      "); + out.println(rs.getString("komentar_konten")); + out.println("

      "); + out.println("
    • "); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +
    +
    + + +
    +
    + +
    + + + +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/UpdateForm.jsp b/web/UpdateForm.jsp new file mode 100644 index 00000000..2467005c --- /dev/null +++ b/web/UpdateForm.jsp @@ -0,0 +1,73 @@ +<%-- + Document : UpdateForm + Created on : Nov 25, 2014, 4:55:12 PM + Author : Teofebano +--%> + +<%@page import="java.sql.ResultSet"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.SQLException"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + <% + Connection con = null; + String user_id= request.getParameter("user_id"); + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + try + { + String sql=("SELECT nama, password, role,email FROM user WHERE user_id='" +user_id+ "'"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + String x = rs.getString("nama"); + String y = rs.getString("password"); + int z = rs.getInt("role"); + String w = rs.getString("email"); + %> +

    Update Details

    +
    +
    Username : +
    Password : +
    Role : +
    Email : +

    +
    + <% + + } + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> + + + diff --git a/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar b/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar new file mode 100644 index 00000000..0236900b Binary files /dev/null and b/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar differ diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml new file mode 100644 index 00000000..58943b55 --- /dev/null +++ b/web/WEB-INF/web.xml @@ -0,0 +1,16 @@ + + + + AddPostHandling + com.tegar.databasehandler.AddPostHandling + + + AddPostHandling + /AddPostHandling + + + + 30 + + + diff --git a/web/add.jsp b/web/add.jsp new file mode 100644 index 00000000..43684e69 --- /dev/null +++ b/web/add.jsp @@ -0,0 +1,64 @@ +<%-- + Document : add + Created on : Nov 25, 2014, 6:32:38 PM + Author : Teofebano +--%> + +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.SQLException"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + <% + String a=request.getParameter("username").toString(); + String b=request.getParameter("password").toString(); + int c= Integer.parseInt(request.getParameter("role")); + String d=request.getParameter("email").toString(); + + + %> + <% + Connection con = null; + + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + try + { + String sql=("INSERT INTO user(role, nama, password, email) VALUES ('"+ c +"','"+ a +"','"+ b +"','"+ d +"')"); + PreparedStatement ps = con.prepareStatement(sql); + ps.executeUpdate(sql); + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + + + response.sendRedirect("ManagementUser.jsp"); + %> + + diff --git a/web/assets/css/screen.css b/web/assets/css/screen.css new file mode 100644 index 00000000..3653e27b --- /dev/null +++ b/web/assets/css/screen.css @@ -0,0 +1,862 @@ +@import url(http://fonts.googleapis.com/css?family=Open+Sans); +@import url(http://fonts.googleapis.com/css?family=Questrial); + +/* Reset & Basics (Inspired by E. Meyers) +================================================== */ +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, address, cite, code, em, img, small, strong, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, embed, figure, figcaption, footer, header, hgroup, menu, nav, section, summary, time, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; } +article, aside, details, figcaption, figure, footer, header, hgroup, menu, time, nav, section { + display: block; } +html, body, .wrapper { + min-height: 100%; +} + + +/* Body +================================================== */ +html, body { + height: 100%; +} +.wrapper { + min-height: 100%; +} +body { + overflow-x: hidden; + font: 17px/28px ff-meta-serif-web-pro, "Georgia", serif; + color: #333; + background: #fff; +} + + +/* Typography +================================================== */ +h1, h2, h3, h4, h5, h6 { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: normal; + text-transform: uppercase; + font-weight: 700; + color: #000; + text-rendering: optimizeLegibility; +} + +h1 { + font-size: 50px; + padding-bottom: 30px; +} + +h2 { + font-size: 45px; + padding-bottom: 25px; +} + +h3 { + font-size: 40px; + padding-bottom: 20px; +} + +h4 { + font-size: 35px; + padding-bottom: 15px; +} + +h5 { + font-size: 30px; + padding-bottom: 10px; +} + +p { + margin: 0 0 28px 0; +} + +strong { + font-weight: bold; +} +em { + font-style: italic; +} +sup { + line-height: 0; +} + +small { + font-size: 70%; +} + +cite { + font-size: 80%; + font-style: italic; + } + +/* Teaser +================================================== */ + +header#teaser h1 { + text-transform: none !important; + color: #333; + font-size: 28px !important; + font-weight: 300 !important; +} + + +/* Links +================================================== */ +a { + color: #F40034; + text-decoration: none; + -webkit-transition: color .2s ease-in-out; + -moz-transition: color .2s ease-in-out; + transition: color .2s ease-in-out; +} +a:hover { + color: #F40034; +} + +/* Layout +================================================== */ +/* White container that is the "page" */ +.wrapper { + max-width: 1500px; + margin: 0 auto; + background: #fff; +} + +/* Containers to keep content to a set width */ +.nav, +.art-header-inner, +.footer, +.art-list, +.abt, +.fourohfour { + width: 980px; +} +.nav, +.art-body-inner, +.footer, +.art-list, +.abt, +.fourohfour { + position: relative; + margin: 0 auto; +} + +/* Nav +================================================== */ +.nav { + position: absolute; + top: 0; + left: 50%; + height: 70px; + padding-top: 40px; + margin-left: -490px; /* Half width of nav */ + border-bottom: 1px solid #333; + z-index: 2; +} +.nav.fixed { + position: fixed; +} +#logo { + float: left; +} +.nav-primary { + float: right; +} +.nav-primary li { + display: inline-block; + margin-left: 10px; + font-weight: 500; +} +#logo h1, +.nav-primary li, +.nav-primary li a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: 700; + font-size: 13px; + line-height: 30px; + color: #000; + text-transform: uppercase; +} + +#logo h1 { + height: 30px; + margin-left: 0px; + letter-spacing: 1px; + font-family: 'Questrial', sans-serif; + font-size: 30px; +} + +#logo h1 span{ + color: #F40034 !important; +} + +.nav li:first-child { + margin-left: 0; /* Remove left margin from the first nav li */ +} + +/* Home Page +================================================== */ + +div#home {} + +#home > div.cover { + max-width: 980px; + margin: 0px auto; + /*padding-top: 110px;*/ +} + +div.cover { + +} + +div.cover > img { + width: 100%; + height: 100%; +} + + +/* Article +================================================== */ +.art { + margin-top: -131px; +} +/* Header */ +.art-header { + height: 900px; + /* Background image is defined in the post */ + background-position: top center; + background-attachment: scroll; + overflow: hidden; +} +/* Contains the time, title and subtitle for an article */ +.art-header-inner { + position: absolute; + top: 300px; + left: 50%; + margin-left: -490px; +} +.art-time, +.art-title, +.art-subtitle { + text-align: center; + text-transform: uppercase; +} +.art-time { + font-size: 14px; + line-height: 1.8; + letter-spacing: 4px; +} +.art-title { + font-size: 100px; + line-height: .9; + letter-spacing: -2px; + width: 100%; +} +.art-subtitle { + margin-top: 4px; + font-size: 14px; + line-height: 1.3; + letter-spacing: 4px; +} + +/* If small header, make few adjustments */ +.small .art-title { + font-size: 70px; + line-height: 65px; +} +.small.art-header-inner { + top: 320px; +} + +/* Body */ +.art-body { + position: relative; + width: 100%; + margin-top: 100px; + background: #fff; + z-index: 100; + -webkit-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + -moz-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + box-shadow: 0 -3px 3px rgba(0,0,0,.2); +} +.art-body-inner { + font-family: Georgia,Cambria,"Times New Roman",Times,serif; + max-width: 640px; + padding: 80px 0 50px; + letter-spacing: 0.01rem; + font-weight: 400; + font-style: normal; + font-size: 21px; + line-height: 1.5; +} +.art-body-inner a:hover { + border-bottom: 1px solid #F40034; + padding-bottom:2px; +} +.art-body-inner ul, +.art-body-inner ol { /* For lists in the article body */ + margin-bottom: 26px; +} +.art-body-inner ul li { + list-style: disc; +} + +.art-body-inner mark { + background-color: #fdffb6; + padding: 2px; + -webkit-box-shadow: #fdffb6 0 0 5px; + -moz-box-shadow: #fdffb6 0 0 5px; + box-shadow: #fdffb6 0 0 5px; +} + +.art-body-inner blockquote { + font-size: 16px; + background: #f9f9f9; + border-left: 10px solid #ccc; + margin: 1.5em 10px; + padding: 0.5em 10px; + quotes: "\201C""\201D""\2018""\2019"; +} + +.art-body-inner blockquote p:first-child:before { + color: #ccc; + content: "“"; + font-size: 4em; + line-height: 0.1em; + margin-right: 0.25em; + vertical-align: -0.4em; +} + +.art-body-inner blockquote p { + margin-bottom: 1.5em; +} + +.art-body-inner blockquote p:last-child { + margin-bottom: 0; +} + + +.dropcap { /* First character on articles */ + float: left; + margin: 47px 10px 20px 0; + font-size: 100px; + line-height: 0; +} +.art-subhead { /* Subheads are used to break up sections of an article */ + margin: 60px 0 15px; + font-size: 20px; + line-height: 28px; + letter-spacing: 3px; +} +.callout { /* Callouts are like large pullquotes */ + font-weight: bold; +} +.art-body-inner img { + max-width: 100%; + max-height: 600px; + margin-bottom: 26px; +} +.art-body-inner img.center { + display: block; + margin-left: auto; + margin-right: auto; +} +.art-body-inner .art-reference { + font-size: 80%; + color: #999; + margin-top: 50px; +} + +/* For simple, white background posts */ +.simple .art-body { + background: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + + +/* List of Articles +================================================== */ +.art-list { + padding: 120px 0 0; +} +.art-list-body { + position: relative; + overflow: hidden; +} +.art-list-item { + padding: 40px 0; + list-style: none; + overflow: hidden; + border-bottom: 1px solid #ccc; +} +.art-list-item:last-child { + border-bottom: none; +} +.art-list-title { + font-size: 26px; + line-height: 26px; + font-weight: 700; +} +.art-list-item-title-and-time { + float: left; + width: 30%; + margin-bottom: 10px; +} +.art-list-time { + font-size: 12px; + line-height: 20px; + letter-spacing: 2px; + text-transform: uppercase; + color: #999; +} +.art-list-title a { + color: #000; +} +.art-list-title a:hover { + color: #F40034; +} +.art-list-item p { + width: 65%; + float: right; + margin-left: 5%; + margin-bottom: 0; + font-size: 16px; + line-height: 24px; +} + + +/* Footer +================================================== */ +.footer { + padding: 30px 0 40px; + overflow: hidden; + border-top: 1px solid #ccc; +} +.footer, +.footer a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-size: 13px; + text-transform: uppercase; + color: #777; +} +.footer a:hover { + color: #000; +} +.back-to-top, +.footer-nav, +.offsite-links { + width: 45%; + float: left; +} +.psi { + width:10%; + float:left; + text-align: center; +} +.footer-nav { + text-align: center; +} +.offsite-links { + text-align: right; +} +.footer .twitter-link:hover { + color: #0084B4; +} +.footer .instagram-link:hover { + color: #3F729B; +} +.footer .github-link:hover { + color: #c5376d; +} +.footer .caffein8-link:hover{ + color: black; +} +.footer .rss-link:hover { + color: #e85d24; +} +/* Remove prev & next links on loop */ +.art-list + .footer .footer-nav, +.abt + .footer .footer-nav { + text-indent: -9999px; + text-align: left; +} + + +/* White Reverse Theme +================================================== */ +/* Nav */ +.nav.white { + border-bottom-color: #fff; + border-bottom-color: rgba(255,255,255,.3); +} +.nav.white li a, +.nav.white li, +.nav.white #logo h1 { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} +.nav.white #logo h1 { + background-position: top center; +} + +nav.pagination{ + text-align: right; + padding-bottom: 25px; +} +/* Art header */ +.art-header.white { + background-color: #111; +} +.art-header.white .art-time, +.art-header.white .art-title, +.art-header.white .art-subtitle { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} + + +/* About page +================================================== */ +.abt { + padding: 200px 0 100px; + list-style: none; +} +.abt .abt-header { + font-size: 140px; + line-height: 1; + text-transform: none; +} +.abt .abt-subheader { + font-size: 24px; + font-style: italic; + text-transform: none; + color: #777; +} +.abt-body { + -moz-column-count: 2; + -moz-column-gap: 20px; + -webkit-column-count: 2; + -webkit-column-gap: 20px; + margin-bottom: 28px; +} +.abt-signoff { + line-height: 1.3; + font-style: italic; + color: #777; +} + +/* 404 page +================================================== */ +.fourohfour { + padding: 240px 0 100px; + text-align: center; +} + +/* Code +================================================== */ + +code, tt { +background: #ededee; +color: #3C4043; +font-size: 90%; +padding: 1px 3px; +} + +pre { + width: 92%; + overflow: auto; + margin: 2rem 0; + padding: 1rem 0.8rem 1rem 1.2rem; + color: #3f3b36; + border: 1px solid #ccc; + border-left: 1rem solid #ccc; + font: lighter 1.2rem/2rem monospace; + background: url(/assets/img/pre.png) repeat 0 -0.9rem; + background-size: 1px 4rem; +} + +pre code, tt { +font-size: inherit; +white-space: -moz-pre-wrap; +white-space: pre-wrap; +background: transparent; +border: none; +padding: 0; +} + + +.gist { + font-size: 14px; +} + + +/* Responsive +================================================== */ +@media only screen and (max-width: 1080px) { + /* Set all of the 980 containers to flexible width */ + .nav, + .art-body-inner, + .art-header-inner, + .footer, + .art-list, + .abt, + .fourohfour { + width: 90%; + } + .nav, + .art-header-inner { + margin-left: -45%; + } +} + +@media only screen and (max-width: 1024px) { + /* Everything becomes scrolling and non-fading */ + .nav, + .nav.fixed { + position: relative; + opacity: 1 !important; /* Important to override JS values */ + display: inline-block; + } + .art-header-inner { + position: relative; + top: 0 !important; /* Important to override JS values */ + margin-top: 240px !important; /* Important to override JS values */ + opacity: 1 !important; /* Important to override JS values */ + } + /* Articles no longer have fixed heights */ + .art-header { + height: auto; + padding-bottom: 100px; + background-size: cover !important; + background-attachment: scroll; + } + /* Remove bottom space out if articles doesn't have a background */ + .simple .art-header { + padding-bottom: 0; + } + .art-list { + padding-top: 0; + } + .abt { + padding: 40px 0; + } + .fourohfour { + padding: 80px 0 60px; + } +} + +@media only screen and (max-width: 780px) { + .art-body-inner ul, + .art-body-inner ol { + margin-left: 20px; + } + .art-title { + letter-spacing: 0; + } + .art-subtitle, + .art-time { + font-size: 12px; + } + .nav { + padding-top: 25px; + height: 55px; + } + .art-list-item-title-and-time, + .art-list-item p { + float: none; + width: auto; + margin-left: 0; + } + .abt-body { + -moz-column-count: 1; + -webkit-column-count: 1; + } +} + +@media only screen and (max-width: 500px) { + .nav-primary li { + margin-left: 10px; + } + .nav #logo h1 { + font-size: 16px; + letter-spacing: -1px; + } + .nav li a { + font-size: 12px; + } + .art-header { + padding-bottom: 50px; + } + .art-header-inner { + margin-top: 190px !important; + } + .art-body-inner { + padding-top: 30px; + } + body { + font-size: 15px; + line-height: 24px; + } + p { + margin-bottom: 24px; + } + .footer { + padding: 10px 0 20px; + } + .back-to-top, + .footer-nav { + width: 50%; + } + .back-to-top { + text-align: left; + } + .footer-nav { + text-align: right; + } + .offsite-links { + float: left; + width: 100%; + text-align: left; + } + .offsite-links a { + font-size: 12px; + } + .art-list + .footer .footer-nav { + display: none; + } + .abt .abt-header { + font-size: 80px; + } + .abt .abt-subheader { + font-size: 18px; + } +} + + +/* Misc +================================================== */ +::selection { + background: #000; + color: #fff; +} +::-moz-selection { + background: #000; + color: #fff; +} +img.left { + float: left; + margin-right: 20px; +} +img.right { + float: right; + margin-left: 20px; +} +/* Clearfixing pile */ +.nav:before, +.art-body-inner:before, +.footer:before, +.art-list:before { + content:""; + display:table; +} +.nav:after, +.art-body-inner:after, +.footer:after, +.art-list:after { + clear:both; +} +.nav, +.art-body-inner, +.footer, +.art-list { + zoom:1; /* For IE 6/7 (trigger hasLayout) */ +} + + +@-webkit-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@-moz-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +.art-header-inner { + -webkit-animation: le-fade .5s 0 1 ease-out; + -moz-animation: le-fade .5s 0 1 ease-out; +} + +.art-list, +.nav, +.abt, +.art-body { + -webkit-animation: le-fade .5s 0s 1 ease-out; + -moz-animation: le-fade .5s 0s 1 ease-out; +} + +hr.featured-article { + padding: 0; + border: none; + border-top: medium double #bbb; + color: #bbb; + text-align: center; +} +hr.featured-article:after { + content: "✭ Featured Article ✭"; + display: inline-block; + position: relative; + top: -0.8em; + font-size: 1.2em; + padding: 0 0.6em; + background: white; +} + +/* FORM */ + +#contact-area { + width: 600px; + margin-top: 25px; +} + +#contact-area input, #contact-area textarea { + padding: 5px; + width: 471px; + font-family: Helvetica, sans-serif; + margin: 0px 0px 10px 0px; + border: 2px solid #ccc; +} + +#contact-area textarea { + height: 90px; +} + +#contact-area textarea:focus, #contact-area input:focus { + border: 2px solid #900; +} + +#contact-area input.submit-button { + width: 100px; + +} + +label { + float: left; + text-align: right; + margin-right: 15px; + width: 100px; + padding-top: 5px; +} \ No newline at end of file diff --git a/web/assets/img/favicon.ico b/web/assets/img/favicon.ico new file mode 100644 index 00000000..40b40ed3 Binary files /dev/null and b/web/assets/img/favicon.ico differ diff --git a/web/assets/img/pre.png b/web/assets/img/pre.png new file mode 100644 index 00000000..7f48517b Binary files /dev/null and b/web/assets/img/pre.png differ diff --git a/web/cookies.jsp b/web/cookies.jsp new file mode 100644 index 00000000..3c1dd330 --- /dev/null +++ b/web/cookies.jsp @@ -0,0 +1,43 @@ +<%-- + Document : cookies + Created on : Nov 24, 2014, 4:06:44 PM + Author : Teofebano +--%> + + + + +Setting Cookies + + +<% + // Create cookies for first and last names. + Cookie username = new Cookie("username",session.getAttribute("username").toString()); + Cookie password = new Cookie("password",session.getAttribute("password").toString()); + String user=session.getAttribute("username").toString(); + String role=session.getAttribute("role").toString(); + int user_id= (Integer) session.getAttribute("user_id"); + + // Set expiry date after 24 Hrs for both the cookies. + username.setMaxAge(60*3); + password.setMaxAge(60*3); + + // Add both the cookies in the response header. + response.addCookie( username ); + response.addCookie( password ); + session.setAttribute("username",user); + session.setAttribute("role",role); + session.setAttribute("user_id",user_id); + if (role == "Owner"){ + response.sendRedirect("home-owner.jsp"); + } + else if (role == "Editor"){ + response.sendRedirect("home-editor.jsp"); + } + else if (role == "Admin"){ + response.sendRedirect("home-admin.jsp"); + } + +%> + + \ No newline at end of file diff --git a/web/delete.jsp b/web/delete.jsp new file mode 100644 index 00000000..c4561d64 --- /dev/null +++ b/web/delete.jsp @@ -0,0 +1,57 @@ +<%-- + Document : delete + Created on : Nov 25, 2014, 3:58:23 PM + Author : Teofebano +--%> + +<%@page import="java.sql.ResultSet"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.SQLException"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + <% + Connection con = null; + String user_id= request.getParameter("user_id"); + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + try + { + String sql=("DELETE FROM user WHERE user_id='" + user_id + "'"); + PreparedStatement ps = con.prepareStatement(sql); + ps.executeUpdate(sql); + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + System.out.println("DELETE FROM user WHERE user_id=" + user_id); + + response.sendRedirect("ManagementUser.jsp"); + %> + + diff --git a/web/edit_post.jsp b/web/edit_post.jsp new file mode 100644 index 00000000..44bba3a2 --- /dev/null +++ b/web/edit_post.jsp @@ -0,0 +1,199 @@ +<%-- + Document : edit_post + Created on : Nov 24, 2014, 2:10:26 PM + Author : tegar +--%> + + +<%@page import="java.sql.Connection"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.ResultSet"%> +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.SQLException"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Edit Post + + + + + +
    + + + +
    + + +

    -

    + +
    +
    +

    Edit Post

    + +
    +
    + + <% + Connection con = null; + try + { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql="SELECT * FROM post WHERE post_id="+request.getParameter("post_id"); + System.out.println(sql); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(""); + out.println(""); + out.println(""); + out.println("
    "); + out.println(""); + out.println(""); + out.println(""); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> + +
    +
    +
    +
    + +
    + + + +
    + + + + + + + + + + + \ No newline at end of file diff --git a/web/home-admin.jsp b/web/home-admin.jsp new file mode 100644 index 00000000..e3596f4a --- /dev/null +++ b/web/home-admin.jsp @@ -0,0 +1,234 @@ +<%-- + Document : home-admin + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
    + + + +
    +
    + +
    +
    + + + +
    + + + + + + + + + + \ No newline at end of file diff --git a/web/home-editor.jsp b/web/home-editor.jsp new file mode 100644 index 00000000..651af444 --- /dev/null +++ b/web/home-editor.jsp @@ -0,0 +1,218 @@ +<%-- + Document : home-editor + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
    + + + +
    +
    + +
    +
    + + + +
    + + + + + + + + + + \ No newline at end of file diff --git a/web/home-owner.jsp b/web/home-owner.jsp new file mode 100644 index 00000000..90e7e14a --- /dev/null +++ b/web/home-owner.jsp @@ -0,0 +1,222 @@ +<%-- + Document : home-owner + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
    + + + +
    +
    + +
    +
    + + + +
    + + + + + + + + + + \ No newline at end of file diff --git a/web/home.jsp b/web/home.jsp new file mode 100644 index 00000000..38d14965 --- /dev/null +++ b/web/home.jsp @@ -0,0 +1,187 @@ +<%-- + Document : LoginCheck + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
    + + + +
    +
    + +
    +
    + + + +
    + + + + + + + + + + \ No newline at end of file diff --git a/web/index.jsp b/web/index.jsp new file mode 100644 index 00000000..c4fe806e --- /dev/null +++ b/web/index.jsp @@ -0,0 +1,172 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
    + + + +
    +
    + +
    +
    + + + +
    + + + + + + + + + + \ No newline at end of file diff --git a/web/login.jsp b/web/login.jsp new file mode 100644 index 00000000..273a75d2 --- /dev/null +++ b/web/login.jsp @@ -0,0 +1,30 @@ +<%-- + Document : login + Created on : Nov 24, 2014, 2:07:37 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Login + + + +
    +

    Login Page

    +

    Login Details

    +
    +
    Username : +
    Password : +

    +
    +
    +
    + Back to main page +
    + + + diff --git a/web/logout.jsp b/web/logout.jsp new file mode 100644 index 00000000..a0dfc9b5 --- /dev/null +++ b/web/logout.jsp @@ -0,0 +1,24 @@ +<%-- + Document : logout + Created on : Nov 24, 2014, 2:24:33 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Logout + + + <% + session.removeAttribute("username"); + session.removeAttribute("password"); + session.invalidate(); + response.sendRedirect("index.jsp"); + %> + + + + diff --git a/web/new_post.jsp b/web/new_post.jsp new file mode 100644 index 00000000..11eb55a6 --- /dev/null +++ b/web/new_post.jsp @@ -0,0 +1,196 @@ +<%-- + Document : new_post + Created on : Nov 24, 2014, 2:10:26 PM + Author : tegar +--%> + + + + +<%@page import="java.util.logging.Logger"%> +<%@page import="java.util.logging.Level"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Statement"%> +<%@page import="java.sql.Connection"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Tambah Post + + + + + +
    + + + +
    + + +

    -

    + +
    +
    +

    Tambah Post

    + +
    +
    + + + + + + <% + System.out.println(request.getParameter("User_Id")); + //Ada user id + out.println(""); + out.println(""); + + %> + +
    + + + + + +
    +
    +
    +
    +
    + +
    + + + +
    + + + + + + + + + + + \ No newline at end of file diff --git a/web/picture/Artikel Dengan Gambar 1.jpg b/web/picture/Artikel Dengan Gambar 1.jpg new file mode 100644 index 00000000..c722133d Binary files /dev/null and b/web/picture/Artikel Dengan Gambar 1.jpg differ diff --git a/web/post.jsp b/web/post.jsp new file mode 100644 index 00000000..2e514fc7 --- /dev/null +++ b/web/post.jsp @@ -0,0 +1,381 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + Connection con2 = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con2 = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con2.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(rs.getString("judul")); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> + + + + + + +
    + + + +
    + +
    +
    + +
    +

    + <% + Connection con1 = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con1 = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con1.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(rs.getString("judul")); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +

    +

    +
    +
    + +
    +
    +
    + <% + Connection con = null; + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String password = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, password); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Connection con; + // con=DBConnect.GetDBConnect(); + try + { + String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id")); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println("

    " + + rs.getString("konten") + + "

    "); + if (!rs.getString("picture_filename").isEmpty()) + { + out.println(""); + } + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +
    + +

    Komentar

    + +
    +
    + "> + "> + + <% + try + { + String sql="SELECT * FROM user WHERE user_id="+request.getParameter("user_id"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + out.println(""); + out.println(""); + out.println(""); + out.println(""); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + + %> +
    + + + +
    +
    + +
    +
      + <% + try + { + String sql=("SELECT * FROM komentar WHERE post_id=" + + "\'" + +request.getParameter("post_id") + + "\'" + +" ORDER BY komentar_tanggal DESC"); + /*String sql=("SELECT * FROM post WHERE post_id="+request.getParameter("post_id"));*/ + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()) + { + + out.println("
    • "); + out.println("
      "); + out.println("

      "); + out.println(rs.getString("komentar_nama")); + out.println("

      "); + out.println("
      "); + out.println(rs.getString("komentar_tanggal")); + out.println("
      "); + out.println("
      "); + out.println("

      "); + out.println(rs.getString("komentar_konten")); + out.println("

      "); + out.println("
    • "); + } + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> +
    +
    + + +
    +
    + +
    + + + +
    + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/showunpublishedposts.jsp b/web/showunpublishedposts.jsp new file mode 100644 index 00000000..57d1550e --- /dev/null +++ b/web/showunpublishedposts.jsp @@ -0,0 +1,204 @@ +<%-- + Document : showunpublishedposts + Created on : Nov 24, 2014, 2:10:26 PM + Author : tegar +--%> + + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
    + + + +
    +
    + +
    +
    + + + +
    + + + + + + + + + \ No newline at end of file diff --git a/web/update.jsp b/web/update.jsp new file mode 100644 index 00000000..2fbd1fcc --- /dev/null +++ b/web/update.jsp @@ -0,0 +1,65 @@ +<%-- + Document : update + Created on : Nov 25, 2014, 4:58:58 PM + Author : Teofebano +--%> + +<%@page import="java.sql.PreparedStatement"%> +<%@page import="java.sql.SQLException"%> +<%@page import="java.sql.DriverManager"%> +<%@page import="java.sql.Connection"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + <% + String a=request.getParameter("username").toString(); + String b=request.getParameter("password").toString(); + String c=request.getParameter("role").toString(); + String d=request.getParameter("email").toString(); + String user_id= request.getParameter("user_id"); + + System.out.println(c); + %> + <% + Connection con = null; + + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + try + { + String sql=("UPDATE user SET role='"+c+"',nama='"+a+"', password='"+b+"', email='"+d+"' WHERE user_id='"+ user_id +"'"); + PreparedStatement ps = con.prepareStatement(sql); + ps.executeUpdate(sql); + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + + + response.sendRedirect("ManagementUser.jsp"); + %> + + diff --git a/web/web/LoginCheck.jsp b/web/web/LoginCheck.jsp new file mode 100644 index 00000000..2be071e1 --- /dev/null +++ b/web/web/LoginCheck.jsp @@ -0,0 +1,99 @@ +<%-- + Document : LoginCheck + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + Login Check + + + <% + String username=request.getParameter("username"); + String password=request.getParameter("password"); + String passwordS = ""; // dari SQL + String rol = ""; + int user_id = 0; + + Connection con = null; + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Retrieve password and role + try + { + String sql=("SELECT user_id, password, role FROM user WHERE nama='"+username+"'"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + + String[] pass = null; + int rl = 0; + int user = 0; + while (rs.next()){ + String em = rs.getString("password"); + rl = rs.getInt("role"); + user = rs.getInt("user_id"); + pass = em.split("\n"); + for (int i =0; i < pass.length; i++){ + System.out.println(pass[i]); + } + } + if (pass != null){ + passwordS = pass[0]; + + switch (rl){ + case 1: rol = "Owner"; break; + case 2: rol = "Editor"; break; + case 3: rol = "Admin"; break; + default : rol = "Guest"; break; + } + + user_id = user; + } + + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + + if( password.equals(passwordS)) + { + session.setAttribute("username",username); + session.setAttribute("password",password); + session.setAttribute("role",rol); + session.setAttribute("user_id",user_id); + response.sendRedirect("cookies.jsp"); + } + else + response.sendRedirect("index.jsp"); + + %> + + + diff --git a/web/web/META-INF/context.xml b/web/web/META-INF/context.xml new file mode 100644 index 00000000..38bc2b4c --- /dev/null +++ b/web/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/web/web/ManagementUser.jsp b/web/web/ManagementUser.jsp new file mode 100644 index 00000000..90601375 --- /dev/null +++ b/web/web/ManagementUser.jsp @@ -0,0 +1,89 @@ +<%-- + Document : ManagementUser + Created on : Nov 24, 2014, 5:24:10 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + Management User + + + + + + + + + + + + <% + + Connection con = null; + // Connect to DB + try { + //Class.forName("com.mysql.jdbc.Driver"); + String url = "jdbc:mysql://localhost:3306/simpleblog_withjava"; + String user = "root"; + String passwordSQL = ""; + + DriverManager.registerDriver(new com.mysql.jdbc.Driver()); + + con = DriverManager.getConnection(url, user, passwordSQL); + } + catch(SQLException ex){ + System.out.println(ex); + } + + // Retrieve password and role + try + { + String sql=("SELECT nama, password, role FROM user"); + PreparedStatement ps = con.prepareStatement(sql); + ResultSet rs = ps.executeQuery(sql); + while (rs.next()){ + String x = rs.getString("nama"); + String y = rs.getString("password"); + int z = rs.getInt("role"); + %> + + + + + + + + + + <% + } + + rs.close(); + con.close(); + %> +
    NamePasswordRoleUpdateDelete
    <% out.println(x); %><% out.println(y); %><% out.println(z); %>
    + + <% + } + catch (SQLException ex) + { + // handle any errors + System.out.println("SQLException: " + ex.getMessage()); + System.out.println("SQLState: " + ex.getSQLState()); + System.out.println("VendorError: " + ex.getErrorCode()); + } + %> + + + \ No newline at end of file diff --git a/web/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar b/web/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar new file mode 100644 index 00000000..0236900b Binary files /dev/null and b/web/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar differ diff --git a/web/web/assets/css/screen.css b/web/web/assets/css/screen.css new file mode 100644 index 00000000..c971008e --- /dev/null +++ b/web/web/assets/css/screen.css @@ -0,0 +1,862 @@ +@import url(http://fonts.googleapis.com/css?family=Open+Sans); +@import url(http://fonts.googleapis.com/css?family=Questrial); + +/* Reset & Basics (Inspired by E. Meyers) +================================================== */ +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, address, cite, code, em, img, small, strong, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, embed, figure, figcaption, footer, header, hgroup, menu, nav, section, summary, time, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; } +article, aside, details, figcaption, figure, footer, header, hgroup, menu, time, nav, section { + display: block; } +html, body, .wrapper { + min-height: 100%; +} + + +/* Body +================================================== */ +html, body { + height: 100%; +} +.wrapper { + min-height: 100%; +} +body { + overflow-x: hidden; + font: 17px/28px ff-meta-serif-web-pro, "Georgia", serif; + color: #333; + background: #fff; +} + + +/* Typography +================================================== */ +h1, h2, h3, h4, h5, h6 { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: normal; + text-transform: uppercase; + font-weight: 700; + color: #000; + text-rendering: optimizeLegibility; +} + +h1 { + font-size: 50px; + padding-bottom: 30px; +} + +h2 { + font-size: 45px; + padding-bottom: 25px; +} + +h3 { + font-size: 40px; + padding-bottom: 20px; +} + +h4 { + font-size: 35px; + padding-bottom: 15px; +} + +h5 { + font-size: 30px; + padding-bottom: 10px; +} + +p { + margin: 0 0 28px 0; +} + +strong { + font-weight: bold; +} +em { + font-style: italic; +} +sup { + line-height: 0; +} + +small { + font-size: 70%; +} + +cite { + font-size: 80%; + font-style: italic; + } + +/* Teaser +================================================== */ + +header#teaser h1 { + text-transform: none !important; + color: #333; + font-size: 28px !important; + font-weight: 300 !important; +} + + +/* Links +================================================== */ +a { + color: #F40034; + text-decoration: none; + -webkit-transition: color .2s ease-in-out; + -moz-transition: color .2s ease-in-out; + transition: color .2s ease-in-out; +} +a:hover { + color: #F40034; +} + +/* Layout +================================================== */ +/* White container that is the "page" */ +.wrapper { + max-width: 1500px; + margin: 0 auto; + background: #fff; +} + +/* Containers to keep content to a set width */ +.nav, +.art-header-inner, +.footer, +.art-list, +.abt, +.fourohfour { + width: 980px; +} +.nav, +.art-body-inner, +.footer, +.art-list, +.abt, +.fourohfour { + position: relative; + margin: 0 auto; +} + +/* Nav +================================================== */ +.nav { + position: absolute; + top: 0; + left: 50%; + height: 70px; + padding-top: 40px; + margin-left: -490px; /* Half width of nav */ + border-bottom: 1px solid #333; + z-index: 2; +} +.nav.fixed { + position: fixed; +} +#logo { + float: left; +} +.nav-primary { + float: right; +} +.nav-primary li { + display: inline-block; + margin-left: 10px; + font-weight: 500; +} +#logo h1, +.nav-primary li, +.nav-primary li a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: 700; + font-size: 13px; + line-height: 30px; + color: #000; + text-transform: uppercase; +} + +#logo h1 { + height: 30px; + margin-left: 0px; + letter-spacing: 1px; + font-family: 'Questrial', sans-serif; + font-size: 30px; +} + +#logo h1 span{ + color: #F40034 !important; +} + +.nav li:first-child { + margin-left: 0; /* Remove left margin from the first nav li */ +} + +/* Home Page +================================================== */ + +div#home {} + +#home > div.cover { + max-width: 980px; + margin: 0px auto; + /*padding-top: 110px;*/ +} + +div.cover { + +} + +div.cover > img { + width: 100%; + height: 100%; +} + + +/* Article +================================================== */ +.art { + margin-top: -131px; +} +/* Header */ +.art-header { + height: 900px; + /* Background image is defined in the post */ + background-position: top center; + background-attachment: scroll; + overflow: hidden; +} +/* Contains the time, title and subtitle for an article */ +.art-header-inner { + position: absolute; + top: 300px; + left: 50%; + margin-left: -490px; +} +.art-time, +.art-title, +.art-subtitle { + text-align: center; + text-transform: uppercase; +} +.art-time { + font-size: 14px; + line-height: 1.8; + letter-spacing: 4px; +} +.art-title { + font-size: 100px; + line-height: .9; + letter-spacing: -2px; + width: 100%; +} +.art-subtitle { + margin-top: 4px; + font-size: 14px; + line-height: 1.3; + letter-spacing: 4px; +} + +/* If small header, make few adjustments */ +.small .art-title { + font-size: 70px; + line-height: 65px; +} +.small.art-header-inner { + top: 320px; +} + +/* Body */ +.art-body { + position: relative; + width: 100%; + margin-top: 100px; + background: #fff; + z-index: 100; + -webkit-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + -moz-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + box-shadow: 0 -3px 3px rgba(0,0,0,.2); +} +.art-body-inner { + font-family: Georgia,Cambria,"Times New Roman",Times,serif; + max-width: 640px; + padding: 80px 0 50px; + letter-spacing: 0.01rem; + font-weight: 400; + font-style: normal; + font-size: 21px; + line-height: 1.5; +} +.art-body-inner a:hover { + border-bottom: 1px solid #F40034; + padding-bottom:2px; +} +.art-body-inner ul, +.art-body-inner ol { /* For lists in the article body */ + margin-bottom: 26px; +} +.art-body-inner ul li { + list-style: disc; +} + +.art-body-inner mark { + background-color: #fdffb6; + padding: 2px; + -webkit-box-shadow: #fdffb6 0 0 5px; + -moz-box-shadow: #fdffb6 0 0 5px; + box-shadow: #fdffb6 0 0 5px; +} + +.art-body-inner blockquote { + font-size: 16px; + background: #f9f9f9; + border-left: 10px solid #ccc; + margin: 1.5em 10px; + padding: 0.5em 10px; + quotes: "\201C""\201D""\2018""\2019"; +} + +.art-body-inner blockquote p:first-child:before { + color: #ccc; + content: "“"; + font-size: 4em; + line-height: 0.1em; + margin-right: 0.25em; + vertical-align: -0.4em; +} + +.art-body-inner blockquote p { + margin-bottom: 1.5em; +} + +.art-body-inner blockquote p:last-child { + margin-bottom: 0; +} + + +.dropcap { /* First character on articles */ + float: left; + margin: 47px 10px 20px 0; + font-size: 100px; + line-height: 0; +} +.art-subhead { /* Subheads are used to break up sections of an article */ + margin: 60px 0 15px; + font-size: 20px; + line-height: 28px; + letter-spacing: 3px; +} +.callout { /* Callouts are like large pullquotes */ + font-weight: bold; +} +.art-body-inner img { + max-width: 100%; + max-height: 600px; + margin-bottom: 26px; +} +.art-body-inner img.center { + display: block; + margin-left: auto; + margin-right: auto; +} +.art-body-inner .art-reference { + font-size: 80%; + color: #999; + margin-top: 50px; +} + +/* For simple, white background posts */ +.simple .art-body { + background: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + + +/* List of Articles +================================================== */ +.art-list { + padding: 120px 0 0; +} +.art-list-body { + position: relative; + overflow: hidden; +} +.art-list-item { + padding: 40px 0; + list-style: none; + overflow: hidden; + border-bottom: 1px solid #ccc; +} +.art-list-item:last-child { + border-bottom: none; +} +.art-list-title { + font-size: 26px; + line-height: 26px; + font-weight: 700; +} +.art-list-item-title-and-time { + float: left; + width: 30%; + margin-bottom: 10px; +} +.art-list-time { + font-size: 12px; + line-height: 20px; + letter-spacing: 2px; + text-transform: uppercase; + color: #999; +} +.art-list-title a { + color: #000; +} +.art-list-title a:hover { + color: #F40034; +} +.art-list-item p { + width: 65%; + float: left; + margin-left: 5%; + margin-bottom: 0; + font-size: 16px; + line-height: 24px; +} + + +/* Footer +================================================== */ +.footer { + padding: 30px 0 40px; + overflow: hidden; + border-top: 1px solid #ccc; +} +.footer, +.footer a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-size: 13px; + text-transform: uppercase; + color: #777; +} +.footer a:hover { + color: #000; +} +.back-to-top, +.footer-nav, +.offsite-links { + width: 45%; + float: left; +} +.psi { + width:10%; + float:left; + text-align: center; +} +.footer-nav { + text-align: center; +} +.offsite-links { + text-align: right; +} +.footer .twitter-link:hover { + color: #0084B4; +} +.footer .instagram-link:hover { + color: #3F729B; +} +.footer .github-link:hover { + color: #c5376d; +} +.footer .caffein8-link:hover{ + color: black; +} +.footer .rss-link:hover { + color: #e85d24; +} +/* Remove prev & next links on loop */ +.art-list + .footer .footer-nav, +.abt + .footer .footer-nav { + text-indent: -9999px; + text-align: left; +} + + +/* White Reverse Theme +================================================== */ +/* Nav */ +.nav.white { + border-bottom-color: #fff; + border-bottom-color: rgba(255,255,255,.3); +} +.nav.white li a, +.nav.white li, +.nav.white #logo h1 { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} +.nav.white #logo h1 { + background-position: top center; +} + +nav.pagination{ + text-align: right; + padding-bottom: 25px; +} +/* Art header */ +.art-header.white { + background-color: #111; +} +.art-header.white .art-time, +.art-header.white .art-title, +.art-header.white .art-subtitle { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} + + +/* About page +================================================== */ +.abt { + padding: 200px 0 100px; + list-style: none; +} +.abt .abt-header { + font-size: 140px; + line-height: 1; + text-transform: none; +} +.abt .abt-subheader { + font-size: 24px; + font-style: italic; + text-transform: none; + color: #777; +} +.abt-body { + -moz-column-count: 2; + -moz-column-gap: 20px; + -webkit-column-count: 2; + -webkit-column-gap: 20px; + margin-bottom: 28px; +} +.abt-signoff { + line-height: 1.3; + font-style: italic; + color: #777; +} + +/* 404 page +================================================== */ +.fourohfour { + padding: 240px 0 100px; + text-align: center; +} + +/* Code +================================================== */ + +code, tt { +background: #ededee; +color: #3C4043; +font-size: 90%; +padding: 1px 3px; +} + +pre { + width: 92%; + overflow: auto; + margin: 2rem 0; + padding: 1rem 0.8rem 1rem 1.2rem; + color: #3f3b36; + border: 1px solid #ccc; + border-left: 1rem solid #ccc; + font: lighter 1.2rem/2rem monospace; + background: url(/assets/img/pre.png) repeat 0 -0.9rem; + background-size: 1px 4rem; +} + +pre code, tt { +font-size: inherit; +white-space: -moz-pre-wrap; +white-space: pre-wrap; +background: transparent; +border: none; +padding: 0; +} + + +.gist { + font-size: 14px; +} + + +/* Responsive +================================================== */ +@media only screen and (max-width: 1080px) { + /* Set all of the 980 containers to flexible width */ + .nav, + .art-body-inner, + .art-header-inner, + .footer, + .art-list, + .abt, + .fourohfour { + width: 90%; + } + .nav, + .art-header-inner { + margin-left: -45%; + } +} + +@media only screen and (max-width: 1024px) { + /* Everything becomes scrolling and non-fading */ + .nav, + .nav.fixed { + position: relative; + opacity: 1 !important; /* Important to override JS values */ + display: inline-block; + } + .art-header-inner { + position: relative; + top: 0 !important; /* Important to override JS values */ + margin-top: 240px !important; /* Important to override JS values */ + opacity: 1 !important; /* Important to override JS values */ + } + /* Articles no longer have fixed heights */ + .art-header { + height: auto; + padding-bottom: 100px; + background-size: cover !important; + background-attachment: scroll; + } + /* Remove bottom space out if articles doesn't have a background */ + .simple .art-header { + padding-bottom: 0; + } + .art-list { + padding-top: 0; + } + .abt { + padding: 40px 0; + } + .fourohfour { + padding: 80px 0 60px; + } +} + +@media only screen and (max-width: 780px) { + .art-body-inner ul, + .art-body-inner ol { + margin-left: 20px; + } + .art-title { + letter-spacing: 0; + } + .art-subtitle, + .art-time { + font-size: 12px; + } + .nav { + padding-top: 25px; + height: 55px; + } + .art-list-item-title-and-time, + .art-list-item p { + float: none; + width: auto; + margin-left: 0; + } + .abt-body { + -moz-column-count: 1; + -webkit-column-count: 1; + } +} + +@media only screen and (max-width: 500px) { + .nav-primary li { + margin-left: 10px; + } + .nav #logo h1 { + font-size: 16px; + letter-spacing: -1px; + } + .nav li a { + font-size: 12px; + } + .art-header { + padding-bottom: 50px; + } + .art-header-inner { + margin-top: 190px !important; + } + .art-body-inner { + padding-top: 30px; + } + body { + font-size: 15px; + line-height: 24px; + } + p { + margin-bottom: 24px; + } + .footer { + padding: 10px 0 20px; + } + .back-to-top, + .footer-nav { + width: 50%; + } + .back-to-top { + text-align: left; + } + .footer-nav { + text-align: right; + } + .offsite-links { + float: left; + width: 100%; + text-align: left; + } + .offsite-links a { + font-size: 12px; + } + .art-list + .footer .footer-nav { + display: none; + } + .abt .abt-header { + font-size: 80px; + } + .abt .abt-subheader { + font-size: 18px; + } +} + + +/* Misc +================================================== */ +::selection { + background: #000; + color: #fff; +} +::-moz-selection { + background: #000; + color: #fff; +} +img.left { + float: left; + margin-right: 20px; +} +img.right { + float: right; + margin-left: 20px; +} +/* Clearfixing pile */ +.nav:before, +.art-body-inner:before, +.footer:before, +.art-list:before { + content:""; + display:table; +} +.nav:after, +.art-body-inner:after, +.footer:after, +.art-list:after { + clear:both; +} +.nav, +.art-body-inner, +.footer, +.art-list { + zoom:1; /* For IE 6/7 (trigger hasLayout) */ +} + + +@-webkit-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@-moz-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +.art-header-inner { + -webkit-animation: le-fade .5s 0 1 ease-out; + -moz-animation: le-fade .5s 0 1 ease-out; +} + +.art-list, +.nav, +.abt, +.art-body { + -webkit-animation: le-fade .5s 0s 1 ease-out; + -moz-animation: le-fade .5s 0s 1 ease-out; +} + +hr.featured-article { + padding: 0; + border: none; + border-top: medium double #bbb; + color: #bbb; + text-align: center; +} +hr.featured-article:after { + content: "✭ Featured Article ✭"; + display: inline-block; + position: relative; + top: -0.8em; + font-size: 1.2em; + padding: 0 0.6em; + background: white; +} + +/* FORM */ + +#contact-area { + width: 600px; + margin-top: 25px; +} + +#contact-area input, #contact-area textarea { + padding: 5px; + width: 471px; + font-family: Helvetica, sans-serif; + margin: 0px 0px 10px 0px; + border: 2px solid #ccc; +} + +#contact-area textarea { + height: 90px; +} + +#contact-area textarea:focus, #contact-area input:focus { + border: 2px solid #900; +} + +#contact-area input.submit-button { + width: 100px; + +} + +label { + float: left; + text-align: right; + margin-right: 15px; + width: 100px; + padding-top: 5px; +} \ No newline at end of file diff --git a/web/web/assets/img/favicon.ico b/web/web/assets/img/favicon.ico new file mode 100644 index 00000000..40b40ed3 Binary files /dev/null and b/web/web/assets/img/favicon.ico differ diff --git a/web/web/assets/img/pre.png b/web/web/assets/img/pre.png new file mode 100644 index 00000000..7f48517b Binary files /dev/null and b/web/web/assets/img/pre.png differ diff --git a/web/web/cookies.jsp b/web/web/cookies.jsp new file mode 100644 index 00000000..5560acc2 --- /dev/null +++ b/web/web/cookies.jsp @@ -0,0 +1,35 @@ +<%-- + Document : cookies + Created on : Nov 24, 2014, 4:06:44 PM + Author : Paulus +--%> + + + + +Setting Cookies + + +<% + // Create cookies for first and last names. + Cookie username = new Cookie("username",session.getAttribute("username").toString()); + Cookie password = new Cookie("password",session.getAttribute("password").toString()); + String user=session.getAttribute("username").toString(); + String role=session.getAttribute("role").toString(); + int user_id= (Integer) session.getAttribute("user_id"); + + // Set expiry date after 24 Hrs for both the cookies. + username.setMaxAge(60*3); + password.setMaxAge(60*3); + + // Add both the cookies in the response header. + response.addCookie( username ); + response.addCookie( password ); + session.setAttribute("username",user); + + session.setAttribute("role",role); + session.setAttribute("user_id",user_id); + response.sendRedirect("ManagementUser.jsp"); +%> + + \ No newline at end of file diff --git a/web/web/edit_post.jsp b/web/web/edit_post.jsp new file mode 100644 index 00000000..8c957105 --- /dev/null +++ b/web/web/edit_post.jsp @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Edit Post + + + + + +
    + + + +
    + + +

    -

    + +
    +
    +

    Edit Post

    + +
    +
    + + + + + + +
    + + + +
    +
    +
    +
    + +
    + + + +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/web/web/home.jsp b/web/web/home.jsp new file mode 100644 index 00000000..4c3dcf82 --- /dev/null +++ b/web/web/home.jsp @@ -0,0 +1,185 @@ +<%-- + Document : LoginCheck + Created on : Nov 24, 2014, 2:10:26 PM + Author : Teofebano +--%> + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
    + + + +
    +
    + +
    +
    + + + +
    + + + + + + + + + + \ No newline at end of file diff --git a/web/web/index.jsp b/web/web/index.jsp new file mode 100644 index 00000000..75ed0b24 --- /dev/null +++ b/web/web/index.jsp @@ -0,0 +1,119 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page language="java" import="java.sql.Connection"%> +<%@ page language="java" import="java.sql.PreparedStatement"%> +<%@ page language="java" import="java.sql.ResultSet"%> +<%@ page language="java" import="java.sql.SQLException"%> +<%@ page language="java" import="java.sql.DriverManager"%> +<%@ page language="java" import="java.util.*"%> +<%@ page language="java" import="java.lang.String"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + + + +
    + + + +
    +
    + +
    +
    + + + +
    + + + + + + + + + + \ No newline at end of file diff --git a/web/web/login.jsp b/web/web/login.jsp new file mode 100644 index 00000000..4e360f9c --- /dev/null +++ b/web/web/login.jsp @@ -0,0 +1,25 @@ +<%-- + Document : login + Created on : Nov 24, 2014, 2:07:37 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Login + + +

    Login Page

    +
    +

    Login Details

    +
    +
    Username: +
    Password: +
    +
    +
    + + diff --git a/web/web/logout.jsp b/web/web/logout.jsp new file mode 100644 index 00000000..a0dfc9b5 --- /dev/null +++ b/web/web/logout.jsp @@ -0,0 +1,24 @@ +<%-- + Document : logout + Created on : Nov 24, 2014, 2:24:33 PM + Author : Teofebano +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + Logout + + + <% + session.removeAttribute("username"); + session.removeAttribute("password"); + session.invalidate(); + response.sendRedirect("index.jsp"); + %> + + + + diff --git a/web/web/new_post.jsp b/web/web/new_post.jsp new file mode 100644 index 00000000..a5315e32 --- /dev/null +++ b/web/web/new_post.jsp @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Tambah Post + + + + + +
    + + + +
    + + +

    -

    + +
    +
    +

    Tambah Post

    + +
    +
    + + + + + + +
    + + + +
    +
    +
    +
    + +
    + + + +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/web/web/post.jsp b/web/web/post.jsp new file mode 100644 index 00000000..00c58864 --- /dev/null +++ b/web/web/post.jsp @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Apa itu Simple Blog? + + + + + +
    + + + +
    + +
    +
    + +
    +

    Apa itu Simple Blog?

    +

    +
    +
    + +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis aliquam minus consequuntur amet nulla eius, neque beatae, nostrum possimus, officiis eaque consectetur. Sequi sunt maiores dolore, illum quidem eos explicabo! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam consequuntur consequatur molestiae saepe sed, incidunt sunt inventore minima voluptatum adipisci hic, est ipsa iste. Nobis, aperiam provident quae. Reprehenderit, iste.

    +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Asperiores animi tenetur nam delectus eveniet iste non culpa laborum provident minima numquam excepturi rem commodi, officia accusamus eos voluptates obcaecati. Possimus?

    + +
    + +

    Komentar

    + +
    +
    + + + + + + +
    + + + +
    +
    + +
      +
    • +
      +

      Jems

      +
      2 menit lalu
      +
      +

      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt! …

      +
    • + +
    • +
      +

      Kave

      +
      1 jam lalu
      +
      +

      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt! …

      +
    • +
    +
    +
    + +
    + + + +
    + + + + + + + + \ No newline at end of file