Guest User

Untitled

a guest
Jan 14th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>YOU ARE NOW LOGGED IN</title>
  4. </head>
  5. <%@page import = "java.sql.*"%>
  6. <body>
  7.  
  8.  
  9.  
  10. <%
  11. String username = request.getParameter("username");
  12.  
  13.  
  14.  
  15. try {
  16. Class.forName("com.mysql.jdbc.Driver");
  17. }
  18. catch(java.lang.ClassNotFoundException e) {
  19. System.err.print("ClassNotFoundException: " + e.getMessage());
  20. }
  21.  
  22. String password="";
  23.  
  24.  
  25.  
  26. try {
  27. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jeana", "root", "xray8916");
  28. Statement stmt;
  29. stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
  30. ResultSet rs = stmt.executeQuery("Select * from user where username = '" +username+ "'");
  31. rs.next();
  32.  
  33. password = rs.getString("password");
  34. stmt.close();
  35. con.close();
  36. }
  37. catch(SQLException ex) { System.err.println("SQLException: " + ex.getMessage()); }
  38.  
  39.  
  40.  
  41.  
  42. String pass = request.getParameter("password");
  43.  
  44. if(pass.equals(password))
  45. {
  46. %><center> <h1> <% out.print("Welcome "+username); %> </h1></center> <%
  47. }
  48. else
  49. {
  50. response.sendRedirect("Jeanaerr.jsp");
  51. }
  52.  
  53. %>
  54.  
  55.  
  56. </body>
  57. </html>
Add Comment
Please, Sign In to add comment