  <%@page import="java.io.InputStreamReader"%>
<%@page import="java.io.BufferedReader"%>
<%@page import="java.io.InputStream"%>
<%@page import="java.sql.*"%>
<%@page import="Dna.Sources.Dbconnection"%>
<%@ page session="true" %>
<%
    Connection con = null;
    Statement st = null;
    ResultSet rs = null;
     ResultSet rs1 = null;
    String pid = request.getParameter("pid");
   Statement st1 = null;
  //String[] filedetails = request.getQueryString().split(",");
  // HttpSession ses=request.getSession(true);
            //String email=ses.getAttribute("email").toString();
  //String polatt1 = "D:/keypolicy_attri.txt";
   String privatekey = request.getParameter("privatekey");
   System.out.println("sdfgfgfgfgff" +  privatekey);
    try {
            
      
        con = Dbconnection.getConnection();
        st = con.createStatement();
         st1 = con.createStatement();
        rs = st.executeQuery("select * from request where pid='"+pid+"'");
           
       rs1 =st1.executeQuery("select * from keygen where pid='" + pid + "'");
       
        
        if (rs.next()) {
            
            String pid1 = rs.getString("pid");
             
             
            if(rs1.next()) {
            if ( rs1.getString("privatekey").equals(rs.getString("privatekey")) )
            {
               
                response.sendRedirect("download.jsp" + pid +"");
            }
            else 
            {
                response.sendRedirect("verify_4.jsp?dmsg=vefication failed key not matched");
            }
            }
            
        } else {
            response.sendRedirect("verify_2.jsp?dmsg=Failed");
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }

%>