public void CreateVulnerabilityFiles(DatabaseAccess JavaDBAccess, String TargetPHPFileSelectedComboBox) {
        int TARGET_PHP_FILES_ID = 0;
        PreparedStatement ps = null;
        String diffFile = "";
        String PHPFileText; //The text of the PHP file where we want to inject the vulnerabilities

        Connection conn = null;

        try {
            if ((conn = JavaDBAccess.setConn()) != null) {
                System.out.println("Connected to database " + JavaDBAccess.getDatabaseName());
            } else {
                throw new Exception("Not connected to database " + JavaDBAccess.getDatabaseName());
            }

            conn.setAutoCommit(false);

            // Start a transaction by inserting a record in the TARGET_PHP_FILES table
            ps = conn.prepareStatement("SELECT ID,TEXT FROM TARGET_PHP_FILES WHERE PATH = ?");
            ps.setString(1, TargetPHPFileSelectedComboBox);
            ResultSet rs = ps.executeQuery();

            rs.next();
            TARGET_PHP_FILES_ID = rs.getInt(1);
            System.out.println("Chave usada: " + TARGET_PHP_FILES_ID);
            /*
            java.io.InputStream ip = rs.getAsciiStream(2);
            int c = ip.read();
            PHPFileText = "";
            while (c > 0) {
            //            System.out.print((char) c);
            
            PHPFileText = PHPFileText + (char) c;
            c = ip.read();
            }
             */
            PHPFileText = rs.getString("TEXT");
            rs.close();

            // Start a transaction by inserting a record in the TARGET_PHP_FILES table
            ps = conn.prepareStatement("SELECT START_CHAR_OF_TARGET_LINE, END_CHAR_OF_TARGET_LINE, VULNERABLE_TEXT, ACTION FROM VULNERABILITY_INJECTION_RESULTS WHERE TARGET_PHP_FILE = ?");
            ps.setInt(1, TARGET_PHP_FILES_ID);
            rs = ps.executeQuery();

            PrintWriter WebPageFileWriter = null;
            while (rs.next()) {
                if (rs.getString(4).equalsIgnoreCase("Remove Line")) {
                    diffFile = PHPFileText.substring(0, rs.getInt(1)) + PHPFileText.substring(rs.getInt(2) + LS.length(), PHPFileText.length());
                } else if (rs.getString(4).equalsIgnoreCase("Remove Function")) {
                    diffFile = PHPFileText.substring(0, rs.getInt(1)) + rs.getString(3) + PHPFileText.substring(rs.getInt(2), PHPFileText.length());
                }

                // Open matches log file.
                try {
                    WebPageFileWriter = new PrintWriter(new FileWriter(TargetPHPFileSelectedComboBox + "_" + rs.getRow() + ".php"));
                } catch (Exception e) {
                    System.out.println("Unable to open matches Web Page log file.");
                }
                // Add URL to matches log file.
                try {
                    WebPageFileWriter.print(diffFile);
                } catch (Exception e) {
                    System.out.println("Unable to Web page log match.");
                }
                WebPageFileWriter.flush();
                // Close matches log file.
                try {
                    WebPageFileWriter.close();
                } catch (Exception e) {
                    System.out.println("Unable to close matches web page log file.");
                }
            }
            rs.close();
            conn.commit();
            conn.close();

        } catch (Throwable e) {
            System.out.println("Errors in CreateVulnerabilityFiles!");
            System.out.println("exception thrown:");

            if (e instanceof SQLException) {
                JavaDBAccess.printSQLError((SQLException) e);
            } else {
                e.printStackTrace();
            }
        }
    }