Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Pull Request Tubes 3 #57

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
halaman index - login + registrasi -> beres
ariefsuharsono committed Apr 12, 2013
commit be6b479ee433ba2ab47f5adc7f5f4b61823b4429
190 changes: 190 additions & 0 deletions src/index.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
<%--
Document : index
Created on : Apr 11, 2013, 10:55:56 AM
Author : Arief
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
if(session.getAttribute("sUsername")!=null)
response.sendRedirect("dashboard.jsp");
%>
<!DOCTYPE html>
<html>
<head>
<title>S.Y.N Login Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="loginpage.css" type="text/css" media="screen">
<script src="registrasi.js"></script>
</head>
<body>
<div id="Front_Logo">
<img src="images/syn.jpg" width="600" height="200">
</div>
<div id="Front_Form">
<h2>Login Form :</h2>
<form action="loginprocess.jsp" id="LoginForm" method="POST">
<table width="350px">
<tr>
<td width="140px">
Username
</td>
<td width="20px">
:
</td>
<td width="140px">
<input type="text" name="username" id="username" required>
</td>
</tr>
<tr>
<td width="140px">
Password
</td>
<td width="20px">
:
</td>
<td width="140px">
<input type="password" name="password" id="password" required>
</td>
</tr>
<tr>
<td colspan="3">
<input type="submit" value="Login">
</td>
</tr>
</table>
</form>
</div>
<br>
<%
if(request.getParameter("error")!=null)
out.println("<h1>"+request.getParameter("error")+"</h1>");
%>
<br>
<div id="Front_Form">
<h2>Registration Form :</h2>
<form action="registerprocess.jsp" method="POST" id="RegistrationForm" onsubmit="return checkValidation();">
<table width="400px">
<tr>
<td width="140px">
Username
</td>
<td width="20px">
:
</td>
<td width="190px">
<input type="text" name="daftar_username" id="daftar_username" onkeyup="checkUsername();checkPassword();" required>
</td>
</tr>
<tr>
<td colspan="3">
<div id="usernameWarning"></div>
</td>
</tr>
<tr>
<td>
Password
</td>
<td>
:
</td>
<td>
<input type="password" name="daftar_password" id="daftar_password" onkeyup="checkPassword();" required>
</td>
</tr>
<tr>
<td colspan="3">
<div id="passwordWarning"></div>
</td>
</tr>
<tr>
<td>
Confirm Pasword
</td>
<td>
:
</td>
<td>
<input type="password" name="daftar_confirmpassword" id="daftar_confirmpassword" onkeyup="checkConfirmPassword();" required>
</td>
</tr>
<tr>
<td colspan="3">
<div id="confirmPasswordWarning"></div>
</td>
</tr>
<tr>
<td>
Nama Lengkap
</td>
<td>
:
</td>
<td>
<input type="text" name="daftar_namalengkap" id="daftar_namalengkap" onkeyup="checkNama();" required>
</td>
</tr>
<tr>
<td colspan="3">
<div id="namaWarning"></div>
</td>
</tr>
<tr>
<td>
Tanggal Lahir
</td>
<td>
:
</td>
<td>
<input type="date" name="daftar_tanggallahir" id="daftar_tanggallahir" required>
</td>
</tr>
<tr>
<td>
e-Mail
</td>
<td>
:
</td>
<td>
<input type="text" name="daftar_e-mail" id="daftar_email" onkeyup="checkEmail();checkPassword();" required>
</td>
</tr>
<tr>
<td colspan="3">
<div id="emailWarning"></div>
</td>
</tr>
<tr>
<td>
Avatar
</td>
<td>
:
</td>
<td>
<input type="file" name="daftar_avatar" id="daftar_avatar" accept="image/jpeg" onchange="check_extension();" required>
</td>
</tr>
<tr>
<td colspan="3">
<div id="avatarWarning"></div>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Daftar">
</td>
<td>
</td>
<td>
<input type="reset" value="Batal">
</td>
</tr>
</table>
</form>
</div>
<script type="text/javascript">
</script>
</body>
</html>
96 changes: 96 additions & 0 deletions src/loginpage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
Document : LoginPage
Created on : Feb 19, 2013, 7:09:01 AM
Author : Arief
Description:
CSS for Login Page
*/


#Front_Logo {
display: block;
width: 600px;
height: 200px;
margin: 0 auto;
margin-top: 25px;
border : 1px solid #ccc;
border-radius : 5px;
-mox-border-radius : 5px;
-webkit-border-radius : 5px;
-o-border-radius : 5px;
border-style: dashed;
padding: 3px;
}

#Front_Form{
text-align: center;
display: block;
width: 400px;
margin: 0 auto;
margin-top: 25px;
border : 1px solid #ccc;
border-radius : 5px;
-mox-border-radius : 5px;
-webkit-border-radius : 5px;
-o-border-radius : 5px;
border-style: dashed;
padding: 3px;
}

#Front_Form input[type=text],#Front_Form input[type="password"]{
border-color: #ccccff;
background-color: grey;
border-width: 1px;
border-style: dashed;
float : left;
color: white;
padding-left: 5px;
width: 190px;
}

#Front_Form input[type=text]:hover,
#Front_Form input[type="password"]:hover{
background-color: #666666;
border-color: #ddddff;
}

#Front_Form input[type=text]:focus,
#Front_Form input[type="password"]:focus{
background-color: #333333;
border-color: #ddddff;
}

#Front_Form input[type=submit],
#Front_Form input[type=reset]{
color: white;
font-family: monospace;
background-color: #666666;
margin-top: 10px;
border-color: whitesmoke;
border-width: 1px;
border-style: dashed;
border-radius : 3px;
}

#Front_Form input[type=submit]:hover,
#Front_Form input[type=reset]:hover{
color: white;
font-family: monospace;
background-color: #333333;
margin-top: 10px;
border-color: whitesmoke;
border-width: 1px;
border-style: dashed;
border-radius : 3px;
}

body {
background-color: grey;
font-family: monospace;
color: white;
text-align: center;
}

iframe {
border:none;
}
25 changes: 25 additions & 0 deletions src/loginprocess.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<%@ page language="java" import="database.MyDatabase,java.sql.ResultSet;" errorPage="" %>

<%
String username = request.getParameter("username");
String password = request.getParameter("password");

String tQuery = "SELECT * FROM user WHERE username='" + username + "' AND password='" + password + "';";
try {
ResultSet tResult = MyDatabase.getSingleton().selectDB(tQuery);
if (tResult.next()) {
session.setMaxInactiveInterval(2592000);
session.setAttribute("isActive",true);
session.setAttribute("sUsername", tResult.getString("username"));
session.setAttribute("sAvatar", tResult.getString("avatar"));
session.setAttribute("sNama", tResult.getString("fullname"));
response.sendRedirect("dashboard.jsp");
} else {
String message = "No user or password matched";
response.sendRedirect("index.jsp?error=" + message);
}
} catch (Exception e) {
e.printStackTrace();
}

%>
Loading