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

        Connection conn = null;
        String PATH = "";

        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 TEXT,PATH,START_CHAR_OF_TARGET_LINE, END_CHAR_OF_TARGET_LINE, VULNERABLE_TEXT, ACTION FROM TARGET_PHP_FILES,VULNERABILITY_INJECTION_RESULTS WHERE VULNERABILITY_INJECTION_RESULTS.TARGET_PHP_FILE=TARGET_PHP_FILES.ID AND VULNERABILITY_INJECTION_RESULTS.ID = ?");
            ps.setInt(1, VULNERABILITY_INJECTION_RESULTS_ID);
            ResultSet rs = ps.executeQuery();

            rs.next();
            PHPFileText = rs.getString("TEXT");
            PATH = rs.getString("PATH");
            if (rs.getString("ACTION").equalsIgnoreCase("Remove Line")) {
                diffFile = PHPFileText.substring(0, rs.getInt("START_CHAR_OF_TARGET_LINE")) + PHPFileText.substring(rs.getInt("END_CHAR_OF_TARGET_LINE") + LS.length(), PHPFileText.length());
            } else if (rs.getString("ACTION").equalsIgnoreCase("Remove Function")) {
                diffFile = PHPFileText.substring(0, rs.getInt("START_CHAR_OF_TARGET_LINE")) + rs.getString("VULNERABLE_TEXT") + PHPFileText.substring(rs.getInt("END_CHAR_OF_TARGET_LINE"), PHPFileText.length());
            }

            PrintWriter WebPageFileWriter = null;
            // Open matches log file.
            try {
                WebPageFileWriter = new PrintWriter(new FileWriter(PATH));
            } 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 ApplyVulnerableFile!");
            System.out.println("exception thrown:");

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