Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html >
- <head>
- <meta charset="UTF-8">
- <title>Day 001 Login Form</title>
- <link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Open+Sans:600'>
- <link rel="stylesheet" href="style.css">
- </head>
- <body>
- <form method="Post" action="login">
- <div class="login-wrap">
- <div class="login-html">
- <input id="tab-1" type="radio" name="tab" class="sign-in" checked><label for="tab-1" class="tab">Sign In</label>
- <input id="tab-2" type="radio" name="tab" class="sign-up"><label for="tab-2" class="tab">Sign Up</label>
- <div class="login-form">
- <div class="sign-in-htm">
- <div class="group">
- <label for="user" class="label">Username</label>
- <input id="user" type="text" class="input">
- </div>
- <div class="group">
- <label for="pass" class="label">Password</label>
- <input id="pass" type="password" class="input" data-type="password">
- </div>
- <div class="group">
- <input id="check" type="checkbox" class="check" checked>
- <label for="check"><span class="icon"></span> Keep me Signed in</label>
- </div>
- <div class="group">
- <input type="submit" class="button" value="login">
- </div>
- <div class="hr"></div>
- <div class="foot-lnk">
- <a href="#forgot">Forgot Password?</a>
- </div>
- </div>
- <div class="sign-up-htm">
- <div class="group">
- <label for="user" class="label">Username</label>
- <input id="user" type="text" class="input">
- </div>
- <div class="group">
- <label for="pass" class="label">Password</label>
- <input id="pass" type="password" class="input" data-type="password">
- </div>
- <div class="group">
- <label for="pass" class="label">Repeat Password</label>
- <input id="pass" type="password" class="input" data-type="password">
- </div>
- <div class="group">
- <label for="pass" class="label">Email Address</label>
- <input id="pass" type="text" class="input">
- </div>
- <div class="group">
- <input type="submit" class="button" value="Sign Up">
- </div>
- <div class="hr"></div>
- <div class="foot-lnk">
- <label for="tab-1">Already Member?</label>
- </div>
- </div>
- </div>
- </div>
- </div>
- </form>
- </body>
- </html>
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- response.setContentType("text/html;charset=UTF-8");
- PrintWriter out = response.getWriter();
- String email = request.getParameter("user");
- String pass = request.getParameter("pass");
- if(Validate.checkUser(email, pass))
- {
- RequestDispatcher rs = request.getRequestDispatcher("Welcome");
- rs.forward(request, response);
- }
- else
- {
- out.println("Username or Password incorrect");
- RequestDispatcher rs = request.getRequestDispatcher("index.html");
- rs.include(request, response);
- } }
- }
- //loading drivers for mysql
- Class.forName("oracle.jdbc.driver.OracleDriver");
- //creating connection with the database
- Connection con=DriverManager.getConnection
- ("jdbc:oracle:thin:@localhost:1521:XE","system","sys");
- PreparedStatement ps =con.prepareStatement
- ("select * from Login where email=? and pass=?");
- ps.setString(1, email);
- ps.setString(2, pass);
- ResultSet rs =ps.executeQuery();
- st = rs.next();
- }catch(Exception e)
- {
- e.printStackTrace();
- }
- return st;
- PrintWriter out = response.getWriter();
- out.println("Welcome user");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement