Advertisement
Guest User

Untitled

a guest
Apr 7th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html >
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Day 001 Login Form</title>
  6.  
  7.  
  8. <link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Open+Sans:600'>
  9.  
  10. <link rel="stylesheet" href="style.css">
  11.  
  12.  
  13. </head>
  14.  
  15. <body>
  16. <form method="Post" action="login">
  17. <div class="login-wrap">
  18. <div class="login-html">
  19. <input id="tab-1" type="radio" name="tab" class="sign-in" checked><label for="tab-1" class="tab">Sign In</label>
  20. <input id="tab-2" type="radio" name="tab" class="sign-up"><label for="tab-2" class="tab">Sign Up</label>
  21. <div class="login-form">
  22. <div class="sign-in-htm">
  23. <div class="group">
  24. <label for="user" class="label">Username</label>
  25. <input id="user" type="text" class="input">
  26. </div>
  27. <div class="group">
  28. <label for="pass" class="label">Password</label>
  29. <input id="pass" type="password" class="input" data-type="password">
  30. </div>
  31. <div class="group">
  32. <input id="check" type="checkbox" class="check" checked>
  33. <label for="check"><span class="icon"></span> Keep me Signed in</label>
  34. </div>
  35. <div class="group">
  36. <input type="submit" class="button" value="login">
  37. </div>
  38. <div class="hr"></div>
  39. <div class="foot-lnk">
  40. <a href="#forgot">Forgot Password?</a>
  41. </div>
  42. </div>
  43. <div class="sign-up-htm">
  44. <div class="group">
  45. <label for="user" class="label">Username</label>
  46. <input id="user" type="text" class="input">
  47. </div>
  48. <div class="group">
  49. <label for="pass" class="label">Password</label>
  50. <input id="pass" type="password" class="input" data-type="password">
  51. </div>
  52. <div class="group">
  53. <label for="pass" class="label">Repeat Password</label>
  54. <input id="pass" type="password" class="input" data-type="password">
  55. </div>
  56. <div class="group">
  57. <label for="pass" class="label">Email Address</label>
  58. <input id="pass" type="text" class="input">
  59. </div>
  60. <div class="group">
  61. <input type="submit" class="button" value="Sign Up">
  62. </div>
  63. <div class="hr"></div>
  64. <div class="foot-lnk">
  65. <label for="tab-1">Already Member?</label>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </form>
  72.  
  73. </body>
  74. </html>
  75.  
  76. @Override
  77. protected void doPost(HttpServletRequest request, HttpServletResponse response)
  78. throws ServletException, IOException {
  79. response.setContentType("text/html;charset=UTF-8");
  80.  
  81. PrintWriter out = response.getWriter();
  82.  
  83. String email = request.getParameter("user");
  84. String pass = request.getParameter("pass");
  85.  
  86. if(Validate.checkUser(email, pass))
  87. {
  88. RequestDispatcher rs = request.getRequestDispatcher("Welcome");
  89. rs.forward(request, response);
  90. }
  91. else
  92. {
  93. out.println("Username or Password incorrect");
  94. RequestDispatcher rs = request.getRequestDispatcher("index.html");
  95. rs.include(request, response);
  96. } }
  97. }
  98.  
  99. //loading drivers for mysql
  100. Class.forName("oracle.jdbc.driver.OracleDriver");
  101.  
  102. //creating connection with the database
  103. Connection con=DriverManager.getConnection
  104. ("jdbc:oracle:thin:@localhost:1521:XE","system","sys");
  105. PreparedStatement ps =con.prepareStatement
  106. ("select * from Login where email=? and pass=?");
  107. ps.setString(1, email);
  108. ps.setString(2, pass);
  109. ResultSet rs =ps.executeQuery();
  110. st = rs.next();
  111.  
  112. }catch(Exception e)
  113. {
  114. e.printStackTrace();
  115. }
  116. return st;
  117.  
  118. PrintWriter out = response.getWriter();
  119. out.println("Welcome user");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement