Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try{
- Class.forName("com.mysql.jdbc.Driver");
- con=DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/vaishnavi","root","atreyasa");
- name=request.getParameter("username");
- password=request.getParameter("password");
- st=con.createStatement();
- st1=con.createStatement();
- rs=st.executeQuery("select * from admins where username='"+name+"' and password='"+password+"'");
- rs1=st1.executeQuery("select * from admins where username='"+name+"' and password!='"+password+"'");
- if(rs!=null&&rs.next()){
- session.setAttribute("username",name);
- response.sendRedirect("http://127.0.0.1:8080/Project_programs/home.jsp");
- }
- else if(rs1!=null&&rs.next()){
- out.println("Enter correct password");
- }
- else{
- response.sendRedirect("http://127.0.0.1:8080/Project_programs/register.jsp");
- }
- }
- catch(Exception e){
- out.println(e);
- }
- out.println("<h1 align=center>Welcome "+session.getAttribute("username")+"</h1>");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement