Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php eval(gzinflate(base64_decode('3RvbbtvI9T1A/mGsBqAUSFaSRfuwsbXYdreti203bbLoQxAQI3Jk0..

Decoded Output download



if (!defined('ABSPATH')) {
    exit;
}

function add_license_admin_page() {
    add_menu_page(
        ' ',
        ' ',
        'manage_options',
        'user_licenses',
        'display_license_admin_page',
        'dashicons-shield',
        60
    );
}
add_action('admin_menu', 'add_license_admin_page');




/*---------------User-----------------*/

add_action('wp_ajax_get_users_list', 'get_users_list');
function get_users_list() {
    $paged = isset($_POST['paged']) ? intval($_POST['paged']) : 1;
    $search = isset($_POST['search']) ? sanitize_text_field($_POST['search']) : '';
    $offset = ($paged - 1) * 10;

    $args = array(
        'status' => 'completed',
        'paginate' => true,
        'limit' => -1,
    );

    $orders = wc_get_orders($args);
    $user_ids = array();

    foreach ($orders->orders as $order) {
        $user_ids[] = $order->get_customer_id();
    }

    $user_ids = array_unique($user_ids);

    if (!empty($search)) {
        $search_user_ids = get_users(array(
            'search' => '*' . esc_attr($search) . '*',
            'fields' => 'ID',
        ));

        $user_ids = array_intersect($user_ids, $search_user_ids);
    }

    $total_users = count($user_ids);
    $total_pages = ceil($total_users / 10);
    $user_ids = array_slice($user_ids, $offset, 10);

    ob_start();
    if ($user_ids) {
        foreach ($user_ids as $user_id) {
            $user = get_userdata($user_id);
            echo '<tr>';
            echo '<td>' . esc_html($user->display_name) . ' (' . esc_html($user->user_email) . ')</td>';
            echo '<td><a href="#" class="uk-button uk-button-primary" data-user-id="' . esc_attr($user_id) . '">  </a></td>';
            echo '</tr>';
        }
    } else {
        echo '<tr><td colspan="2">  !!</td></tr>';
    }
    $output = ob_get_clean();

    wp_send_json_success(array('html' => $output, 'total_pages' => $total_pages));
}




add_action('wp_ajax_get_user_licenses', 'get_user_licenses');
function get_user_licenses() {
    if (!isset($_POST['user_id']) || !is_numeric($_POST['user_id'])) {
        wp_send_json_error('Invalid user ID.');
    }

    $user_id = intval($_POST['user_id']);
    $user = get_userdata($user_id);
    if (!$user) {
        wp_send_json_error('   !!');
    }

    ob_start();
    display_user_licenses($user_id);
    $output = ob_get_clean();

    wp_send_json_success($output);
}




function display_user_licenses($user_id) {
    $user = get_userdata($user_id);
    $orders = wc_get_orders(array(
        'customer_id' => $user_id,
        'status' => 'completed'
    ));

    echo '<h5>: ' . esc_html($user->display_name) . ' (' . esc_html($user->user_email) . ')</h5>';

    if (!empty($orders)) {
        echo '<div class="uk-overflow-auto">';
        echo '<table class="uk-table uk-table-divider">';
        echo '<thead><tr><th></th><th>  </th><th> </th><th></th><th></th></tr></thead>';
        echo '<tbody>';

        foreach ($orders as $order) {
            foreach ($order->get_items() as $item_id => $item) {
                $product_name = $item->get_name();
                $product_id = $item->get_product_id();
                $domains_count = get_user_domain_count($user_id, $product_id, $item_id);
                $domains = get_user_domains($user_id, $product_id, $item_id);

                echo '<tr>';
                echo '<td><a href="' . get_permalink($product_id) . '">' . esc_html($product_name) . '</a></td>';
                echo '<td>' . esc_html($domains_count) . '</td>';
                echo '<td class="domains-column">';
                foreach ($domains as $domain) {
                    echo '<span class="domain-name">' . esc_html($domain) . '</span><br>';
                }
                echo '</td>';

                echo '<td>';
                foreach ($domains as $domain) {
                    $meta_key = "license_status_{$product_id}_{$domain}";
                    $status = get_user_meta($user_id, $meta_key, true) === 'active' ? '' : '';
                    $button_class = $status === '' ? 'uk-button-primary' : 'uk-button-danger';
                    echo '<button class="toggle-license uk-button uk-button-small ' . esc_attr($button_class) . '" data-user-id="' . esc_attr($user_id) . '" data-product-id="' . esc_attr($product_id) . '" data-domain="' . esc_attr($domain) . '">' . esc_html(ucfirst($status)) . '</button><br>';
                }
                echo '</td>';

                echo '<td>';
                foreach ($domains as $domain) {
                    echo '<div class="domain-container">';
                    echo '<button class="edit-domain uk-button uk-button-small uk-button-primary" data-user-id="' . esc_attr($user_id) . '" data-product-id="' . esc_attr($product_id) . '" data-order-item-id="' . esc_attr($item_id) . '" data-domain="' . esc_attr($domain) . '"> </button><br>';
                    echo '</div>';
                }
                echo '</td>';

                echo '</tr>';
            }
        }

        echo '</tbody>';
        echo '</table>';
        echo '</div>';
    } else {
        echo '<p>       .</p>';
    }
}





add_action('wp_ajax_edit_user_domain', 'edit_user_domain');
function edit_user_domain() {
    if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'toggle-license-nonce')) {
        wp_send_json_error('Invalid nonce.');
    }

    if (!isset($_POST['user_id']) || !isset($_POST['product_id']) || !isset($_POST['order_item_id']) || !isset($_POST['old_domain']) || !isset($_POST['new_domain'])) {
        wp_send_json_error('Missing parameters.');
    }

    $user_id = intval($_POST['user_id']);
    $product_id = intval($_POST['product_id']);
    $order_item_id = intval($_POST['order_item_id']);
    $old_domain = sanitize_text_field($_POST['old_domain']);
    $new_domain = sanitize_text_field($_POST['new_domain']);

    $meta_key_old = "license_status_{$product_id}_{$old_domain}";
    $meta_key_new = "license_status_{$product_id}_{$new_domain}";
    $current_status = get_user_meta($user_id, $meta_key_old, true);

    // Set default status to active if no status is found
    if (empty($current_status)) {
        $current_status = 'active';
    }

    // Update domain in user meta
    update_user_meta($user_id, $meta_key_new, $current_status);
    delete_user_meta($user_id, $meta_key_old);

    // Update domain list in product meta
    $meta_key = '_user_domain_' . $user_id . '_' . $product_id . '_' . $order_item_id;
    $domains = get_user_domains($user_id, $product_id, $order_item_id);

    if (($key = array_search($old_domain, $domains)) !== false) {
        unset($domains[$key]);
    }

    $domains[] = $new_domain;
    update_post_meta($product_id, $meta_key, $domains);

    // Get updated domains after update
    $domains = get_user_domains($user_id, $product_id, $order_item_id);

    // Send updated domains back as JSON response
    wp_send_json_success(array(
        'domains' => $domains,
        'current_status' => $current_status,
    ));
}





add_action('wp_ajax_toggle_license_status', 'toggle_license_status');
function toggle_license_status() {
    // Check nonce
    if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'toggle-license-nonce')) {
        wp_send_json_error('Invalid nonce.');
    }

    // Check required fields
    if (!isset($_POST['user_id']) || !isset($_POST['product_id']) || !isset($_POST['domain'])) {
        wp_send_json_error('Invalid parameters.');
    }

    // Ensure the user is authenticated
    if (!is_user_logged_in()) {
        wp_send_json_error('User not logged in.');
    }

    $user_id = intval($_POST['user_id']);
    $product_id = intval($_POST['product_id']);
    $domain = sanitize_text_field($_POST['domain']);

    $meta_key = "license_status_{$product_id}_{$domain}";
    $current_status = get_user_meta($user_id, $meta_key, true);

    // If current status is not set, default to "active"
    if (empty($current_status)) {
        $current_status = 'active';
    }

    // Toggle the status
    $new_status = ($current_status === 'active') ? 'disabled' : 'active';
    update_user_meta($user_id, $meta_key, $new_status);

    wp_send_json_success(array('status' => $new_status));
}



/*--------------- Shop-----------------*/

add_action('wp_ajax_get_products_list', 'get_products_list');
function get_products_list() {
    $paged = isset($_POST['paged']) ? intval($_POST['paged']) : 1;
    $search = isset($_POST['search']) ? sanitize_text_field($_POST['search']) : '';
    $offset = ($paged - 1) * 10;

    $args = array(
        'post_type' => 'product',
        'posts_per_page' => 10,
        'paged' => $paged,
        's' => $search,
        'post_status' => 'publish',
    );

    $query = new WP_Query($args);
    $total_products = $query->found_posts;
    $total_pages = $query->max_num_pages;

    ob_start();
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            global $product;

            // Get or generate license code
            $license_code = get_post_meta(get_the_ID(), '_product_license_code', true);
            if (empty($license_code)) {
                $license_code = generate_unique_code(); // Generate new license code if not already set
                update_post_meta(get_the_ID(), '_product_license_code', $license_code);
            }

            echo '<tr>';
            echo '<td>' . get_the_title() . '</td>';
            echo '<td>' . $license_code . '</td>';
            echo '<td><button class="uk-button uk-button-primary generate-license" data-product-id="' . get_the_ID() . '">  </button></td>';
            echo '</tr>';
        }
        wp_reset_postdata();
    } else {
        echo '<tr><td colspan="3">   !!</td></tr>';
    }
    $output = ob_get_clean();

    wp_send_json_success(array('html' => $output, 'total_pages' => $total_pages));
}

function generate_unique_code($length = 32) {
    return bin2hex(random_bytes($length / 2));
}

add_action('wp_ajax_get_product_details', 'get_product_details');
function get_product_details() {
    if (!isset($_POST['product_id']) || !is_numeric($_POST['product_id'])) {
        wp_send_json_error('Invalid product ID.');
    }

    $product_id = intval($_POST['product_id']);
    $product = wc_get_product($product_id);
    if (!$product) {
        wp_send_json_error('Product not found.');
    }

    // Generate unique code
    $unique_code = generate_unique_code();

    // Save unique code in post meta
    update_post_meta($product_id, '_product_license_code', $unique_code);

    // Return the unique code instead of product details
    wp_send_json_success($unique_code);
}






/*--------------------------------*/

function display_license_admin_page() {

    require_once plugin_dir_path(__FILE__) . 'template/navbar.php';
    require_once plugin_dir_path(__FILE__) . 'template/general.php';
    require_once plugin_dir_path(__FILE__) . 'template/product.php';
    require_once plugin_dir_path(__FILE__) . 'template/setting.php';
    require_once plugin_dir_path(__FILE__) . 'template/label.php';
    require_once plugin_dir_path(__FILE__) . 'template/help.php';
    require_once plugin_dir_path(__FILE__) . 'template/info.php';
    require_once plugin_dir_path(__FILE__) . 'template/button.php';
}




function enqueue_admin_license_scripts() {
    $current_screen = get_current_screen();
    if ($current_screen->id == 'toplevel_page_user_licenses') {
        wp_enqueue_style('uikit-rtl', plugin_dir_url(__FILE__) . 'assets/css/uikit-rtl.min.css');
        wp_enqueue_style('admin-styles', plugin_dir_url(__FILE__) . 'assets/css/admin-styles.css');
        wp_enqueue_style('styles-rtl', plugin_dir_url(__FILE__) . 'assets/css/admin-styles-rtl.css');
        wp_enqueue_style('colors-min', plugin_dir_url(__FILE__) . 'assets/css/colors.min.css');
        wp_enqueue_script('jquery-ui-tabs');
        wp_enqueue_script('my-custom-scripts', plugin_dir_url(__FILE__) . 'assets/js/custom-admin.js', array('jquery'), null, true);
        wp_enqueue_script('admin-scripts', plugin_dir_url(__FILE__) . 'assets/js/admin-scripts.js', array('jquery'), null, true);
        wp_enqueue_script('uikit-icons', plugin_dir_url(__FILE__) . 'assets/js/uikit-icons.min.js', array('jquery'), null, true);
        wp_enqueue_script('uikit-min', plugin_dir_url(__FILE__) . 'assets/js/uikit.min.js', array('jquery'), null, true);
        wp_enqueue_script('setting', plugin_dir_url(__FILE__) . 'assets/js/setting.js', array('jquery'), null, true);
        wp_enqueue_script('colors-min', plugin_dir_url(__FILE__) . 'assets/js/colors.min.js', array('jquery'), null, true);
        wp_enqueue_script('license-script', plugin_dir_url(__FILE__) . 'assets/js/admin-license-script.js', array('jquery'), null, true);
        wp_enqueue_script('u-admin', plugin_dir_url(__FILE__) . 'assets/js/u-admin.js', array('jquery'), null, true);

        // Localize script after enqueueing it
        wp_localize_script('license-script', 'admin_license_ajax', array(
            'ajax_url' => admin_url('admin-ajax.php'),
            'nonce' => wp_create_nonce('toggle-license-nonce')
        ));

    }
}
add_action('admin_enqueue_scripts', 'enqueue_admin_license_scripts');






require_once plugin_dir_path(__FILE__) . 'setting.php';

Did this file decode correctly?

Original Code

<?php
eval(gzinflate(base64_decode('3RvbbtvI9T1A/mGsBqAUSFaSRfuwsbXYdreti203bbLoQxAQI3Jk0aFIhhw68e76oUDWyUP+w62LNkiTtki/hEp+pufMhZwhKYmOvYttlYdIM3Muc+5nZnz1ytUrwYz0t3w2CyLm951Pf373zqf3fu0MBuSbq1cIfNiTgN++euX4Kqyd5ZHHgzgi1PfdMPBYlDGX+osgchO6z/olEM4vWJTLYTmGH2f5tDh9/6J4vTwpXpPls+LUGXaeXdAIsLlxgixk1lSesVQzZM/4QZaE9KiFW3sZzeaBB2hH8D8LfXPyZzfk94EUA+6NCjH0HYkNd+oMidMuFQfh9L/x9ZH9+Qo4H9U/18e41iT0OHHpAX3i7jPu4mYzIJRxJFobQWKlmuy5Sj3XkC+f7JIgyxjvX3PvfHn33n1HjDoPBuQTEkT8kIbNmY/JzdsKR8Zo6s0bSOSwxJLRKODB18zl7Al3ZyjYlnUfE8fRSOPZDJAB0r7icURuDsh1cvOGEKJYQ9P9DFbQNKVHpm1lnPI8c8juhDhevEhCxpmlSNxGEFHOxBqe5sycDINFwMXM6Oaw0rhmLPVBjkD2sSeUIH/3B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dUTi8BSc21TZWPqpUHCjdBYNWNeylikSjB70C427bnRBAPZLqaVJGSHTCaS+hu7WiTSvGX8CAoPJw8eBnyU8hD82Nh+nob27ilG8GzsZdm4BNmG3W3DiGNWRU0SQgoj8SPrTsWE6kBELjzfRkwSYj+byUBhEafZaCGuvDqSkTAbhSWso+8cyB4gD/Bt1sbVi6ORfO02UtbVja0D4EqCCRlsHyCcKlskAw6UxFEehs0Kv4ULJchzcmBBXZQFaZTibzQ6M2DAbF+CFCS6zqahGbgM0ipEdyasQ/oFyZ7XGw4sZ7ggcX1ILH+f0+ps4AtrXrpRd72fw+0qwlBQfRF7UOZ+zYikrO5CFDt4yRtwi9FQrV8tNMfOUdgHlDzZ/ZojegTYlehcJBjuUXk/zoqcOKj//YY8xUcg4AgSF5aY8g5gxXl/BW+8xD1e8ddVti5Ew7I2/Vp/b4X/ulcAViH0Xw==')));?>

Function Calls

gzinflate 1
base64_decode 1

Variables

None

Stats

MD5 18cd6994a4f761e2f6f48278bde61062
Eval Count 1
Decode Time 63 ms