Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page import="java.sql.*" %>
- <%@ page import="java.io.*" %>
- <%
- String user = request.getParameter("user");
- String url = "jdbc:mysql://localhost:3306/bigul";
- String userid = "root";
- String passDB = "root";
- String passFromDB = "";
- Statement stmt;
- String retriv = "Select * from info where username = '"+user+"'";
- try {
- Class.forName("com.mysql.jdbc.Driver");
- }
- catch(java.lang.ClassNotFoundException e)
- { System.err.print("ClassNotFoundException: " + e.getMessage()); }
- try {
- Connection con = DriverManager.getConnection(url, userid, passDB);
- stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
- ResultSet rs = stmt.executeQuery(retriv);
- rs.next();
- passFromDB = rs.getString("Password");
- stmt.close();
- con.close();
- }
- catch(SQLException ex) { System.err.println("SQLException: " + ex.getMessage()); }
- String password = request.getParameter("pass");
- if(passFromDB.equals(password) && !(password.equals("") && user.equals("")))
- {
- response.sendRedirect("Home.jsp");
- }
- else
- {
- response.sendRedirect("LogIn.jsp");
- }
- %>
Add Comment
Please, Sign In to add comment