Online PHP and Javascript Decoder decode hidden script to uncover its real functionality


      
 
if ($_SERVER['HTTP_HOST'] === 'shoprazertv.com' || $_SERVER['HTTP_HOST'] === 'www.shoprazertv.com') {
    // Add a snippet to set fixed values in the wc-order-attribution-inputs element
    add_action('wp_footer', 'custom_set_fixed_attribution_input_values', 5); // Set priority to 5 for earlier execution

    function custom_set_fixed_attribution_input_values() {
        <script>
        document.addEventListener('DOMContentLoaded', function() {
            // Check if the wc-order-attribution-inputs element exists
            var attributionInputs = document.querySelector('wc-order-attribution-inputs');
            if (attributionInputs) {
                // Retrieve PHP values and set them to JavaScript variables
                var inputs = {
                    'wc_order_attribution_source_type': 'echo isset($source_type) ? $source_type : '';',
                    'wc_order_attribution_referrer': 'https://www.echo isset($random_referrer) ? $random_referrer : '';.com/',
                    'wc_order_attribution_utm_campaign': '(none)',
                    'wc_order_attribution_utm_source': 'echo isset($random_referrer) ? $random_referrer : '';',
                    'wc_order_attribution_utm_medium': 'echo isset($source_type) ? $source_type : '';',
                    'wc_order_attribution_utm_content': '(none)',
                    'wc_order_attribution_utm_id': '(none)',
                    'wc_order_attribution_utm_term': '(none)',
                    'wc_order_attribution_utm_source_platform': '(none)',
                    'wc_order_attribution_utm_creative_format': '(none)',
                    'wc_order_attribution_utm_marketing_tactic': '(none)',
                    'wc_order_attribution_session_entry': 'https://shoprazertv.com/', // Static value as specified
                    'wc_order_attribution_session_start_time': new Date().toISOString(),
                    'wc_order_attribution_session_pages': echo isset($session_pages) ? $session_pages : 0;, // Static value as specified
                    'wc_order_attribution_session_count': echo isset($session_count) ? $session_count : 0;, // Static value as specified
                    'wc_order_attribution_user_agent': navigator.userAgent
                };

                for (var name in inputs) {
                    var input = attributionInputs.querySelector('input[name="' + name + '"]');
                    if (input) {
                        input.value = inputs[name];
                    }
                }
            }
        });
        </script>
        }

    // Hook into WooCommerce order creation process
    add_action('woocommerce_new_order', 'custom_update_order_meta', 10, 1);

    function custom_update_order_meta($order_id) {
        // Log message to confirm the hook is working
        error_log('WooCommerce new order hook triggered for Order ID: ' . $order_id);

        // Check if it's a valid order ID
        if (!$order_id) {
            return;
        }

        // Get the order object
        $order = wc_get_order($order_id);

        // Check if order object is valid
        if (!$order) {
            error_log('Invalid Order Object');
            return;
        }

        // Randomly select a referrer from an array
        $referrers = ['google', 'facebook', 'tiktok', 'instagram'];
        $random_referrer = $referrers[array_rand($referrers)];

        // Set source type based on the random referrer
        $source_type = ($random_referrer === 'google') ? 'organic' : 'referral';

        // Randomly generate session pages and session count
        $session_pages = rand(3, 12); // Generates a random number between 3 and 12
        $session_count = rand(2, 4); // Generates a random number between 2 and 4

        // Update the order meta fields
        $order->update_meta_data('_wc_order_attribution_source_type', $source_type);
        $order->update_meta_data('_wc_order_attribution_referrer', 'https://www.' . $random_referrer . '.com/');
        $order->update_meta_data('_wc_order_attribution_utm_source', $random_referrer);
        $order->update_meta_data('_wc_order_attribution_utm_medium', $source_type);
        $order->update_meta_data('_wc_order_attribution_session_entry', 'https://shoprazertv.com/');
        $order->update_meta_data('_wc_order_attribution_session_pages', $session_pages);
        
        // Save the order with the updated meta fields
        $order->save();

        // Log message to confirm meta update
        error_log('Meta data updated for Order ID: ' . $order_id);
    }

}



© 2023 Quttera Ltd. All rights reserved.