Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>YOU ARE NOW LOGGED IN</title>
- </head>
- <%@page import = "java.sql.*"%>
- <body>
- <%
- String username = request.getParameter("username");
- try {
- Class.forName("com.mysql.jdbc.Driver");
- }
- catch(java.lang.ClassNotFoundException e) {
- System.err.print("ClassNotFoundException: " + e.getMessage());
- }
- String password="";
- try {
- Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jeana", "root", "xray8916");
- Statement stmt;
- stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
- ResultSet rs = stmt.executeQuery("Select * from user where username = '" +username+ "'");
- rs.next();
- password = rs.getString("password");
- stmt.close();
- con.close();
- }
- catch(SQLException ex) { System.err.println("SQLException: " + ex.getMessage()); }
- String pass = request.getParameter("password");
- if(pass.equals(password))
- {
- %><center> <h1> <% out.print("Welcome "+username); %> </h1></center> <%
- }
- else
- {
- response.sendRedirect("Jeanaerr.jsp");
- }
- %>
- </body>
- </html>
Add Comment
Please, Sign In to add comment