how to compare password in the input box with the password in database?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   night_nakita
Posted On:   Tuesday, September 30, 2003 12:39 AM

<%@ page import="java.sql.*" %> <% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:EEE"); Statement stmt = con.createStatement(); String user = request.getParameter("username"); ResultSet rs = stmt.executeQuery("SELECT password FROM teacher WHERE Name='username'"); String pwd = request.getParameter("pwd"); String password = rs.getString("password"); if (pwd.equals("password") ) { response.sendRedirect("EEE_main.jsp"); } else { response.sendRedirect("login_bad.jsp"); } con.close(); %>    More>>
<%@ page import="java.sql.*" %>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:EEE");
Statement stmt = con.createStatement();
String user = request.getParameter("username");
ResultSet rs = stmt.executeQuery("SELECT password FROM teacher WHERE Name='username'");
String pwd = request.getParameter("pwd");
String password = rs.getString("password");
if (pwd.equals("password") ) {
response.sendRedirect("EEE_main.jsp");
} else {
response.sendRedirect("login_bad.jsp");
}
con.close();
%>

can any 1 help
althought no error found but it cannot compare the password    <<Less

Re: how to compare password in the input box with the password in database?

Posted By:   Sujatha_Gopal  
Posted On:   Wednesday, October 1, 2003 01:28 AM

Check once the username in this query


ResultSet rs = stmt.executeQuery("SELECT password FROM teacher WHERE Name='username'");




Actually it should the variable user which is assigned in this statement


String user = request.getParameter("username");
About | Sitemap | Contact