<%@page import="java.sql.ResultSet"%>

<%@page import="test.DbManager"%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>

<% 

String oldpass,newpass,confirmpass;

oldpass=request.getParameter("opass");

newpass=request.getParameter("npass");

confirmpass=request.getParameter("cpass");

DbManager db=new DbManager();

String cmd="update lgtable set pass='"+newpass+"' where username='"+session.getAttribute("admin")+"' and pass='"+oldpass+"'";

boolean b=db.ExecuteInsertUpdateDelete(cmd);

if (newpass.equals(confirmpass))

{

if(b==true)

{

   

out.print("<script>alert('password changed Successfully...');"

        + "+window.location.href='../changepassword.jsp'</script>");

}

else

{

out.print("<script>alert('password not changed ...');"

       + "+window.location.href='../changepassword.jsp'</script>");

}

}

else

{

out.print("<script>alert('confirm password is not matched...');"

        + "+window.location.href='../changepassword.jsp'</script>");

}

%>