<%@page import=”project.ConnectionProvider” %>
<%@page import=”java.sql.* “%>
<%
String email=request.getParameter(“email”);
<code>String password = request.getParameter("Password");
System.out.println("1");
System.out.println(email);
System.out.println(password);
if(("[email protected]".equals(email)) && ("admin".equals(password))){
session.setAttribute("email",email);
response.sendRedirect("admin/adminHome.jsp");
System.out.println("a");
}
</code>
<code>String password = request.getParameter("Password");
System.out.println("1");
System.out.println(email);
System.out.println(password);
if(("[email protected]".equals(email)) && ("admin".equals(password))){
session.setAttribute("email",email);
response.sendRedirect("admin/adminHome.jsp");
System.out.println("a");
}
</code>
String password = request.getParameter("Password");
System.out.println("1");
System.out.println(email);
System.out.println(password);
if(("[email protected]".equals(email)) && ("admin".equals(password))){
session.setAttribute("email",email);
response.sendRedirect("admin/adminHome.jsp");
System.out.println("a");
}
your text
else{
<code> System.out.println("2");
try{
</code>
<code> System.out.println("2");
try{
</code>
System.out.println("2");
try{
int z=0;
Connection con = ConnectionProvider.getCon();
<code> Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from users where email='"+email+"' and password='"+password+"'");
System.out.println("3");
while(rs.next()){
z=1;
session.setAttribute("email", email);
response.sendRedirect("home.jsp");
System.out.println("4");
}
response.sendRedirect("login.jsp?msg=notexist");
System.out.println("5");
}
catch(Exception e){
System.out.println(e);
response.sendRedirect("login.jsp?msg=Invalid");
}
}
</code>
<code> Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from users where email='"+email+"' and password='"+password+"'");
System.out.println("3");
while(rs.next()){
z=1;
session.setAttribute("email", email);
response.sendRedirect("home.jsp");
System.out.println("4");
}
response.sendRedirect("login.jsp?msg=notexist");
System.out.println("5");
}
catch(Exception e){
System.out.println(e);
response.sendRedirect("login.jsp?msg=Invalid");
}
}
</code>
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from users where email='"+email+"' and password='"+password+"'");
System.out.println("3");
while(rs.next()){
z=1;
session.setAttribute("email", email);
response.sendRedirect("home.jsp");
System.out.println("4");
}
response.sendRedirect("login.jsp?msg=notexist");
System.out.println("5");
}
catch(Exception e){
System.out.println(e);
response.sendRedirect("login.jsp?msg=Invalid");
}
}
%>
output is showing
1
2
3
5
i tried many things but still it is not working
New contributor
Rio Tokyo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
4