Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
- <%@page import="java.util.*"%>
- <%@page import="java.sql.*"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Insert title here</title>
- </head>
- <body>
- <%
- String userid = request.getParameter("loginid");
- String password = request.getParameter("password");
- //Step1: Load JDBC Driver
- Class.forName("com.mysql.jdbc.Driver");
- // Step 2: Define Connection URL
- String connURL = "jdbc:mysql://localhost/login?user=root&password=root";
- // Step 3: Establish connection to URL
- Connection conn = DriverManager.getConnection(connURL);
- //String password = request.getParameter("password");
- String sql="Select * from new_table where userid=? and password=?";
- PreparedStatement pstmt=conn.prepareStatement(sql);
- pstmt.setString(1, userid);
- pstmt.setString(2, password);
- ResultSet rs=pstmt.executeQuery();
- out.println("<table border='1'");
- if (rs.next()){
- response.sendRedirect("displaymember.jsp");
- } else {
- response.sendRedirect("login.jsp?login=fail");
- }
- conn.close();
- /* out.println("Welcome, Lincol" + "<br/>");
- out.println("Your userid is: " + userid + "<br/>");
- out.println("Password is: " + password + "<br/>"); */
- %> -->
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement