Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php $tsFile = base64_decode($_GET['token']); $privateKey = base64_decode('TWF2ZXJsaW..

Decoded Output download

<?php 
 
$tsFile = base64_decode($_GET['token']); 
$privateKey = base64_decode('TWF2ZXJsaWNrMDkyNEAkJSE='); 
 
function decrypt($aesKey, $dataToDecrypt) { 
    $output = false; 
    $iv = NULL; 
    $dataToDecrypt = base64_decode($dataToDecrypt); 
    $output = openssl_decrypt($dataToDecrypt, 'AES-256-CBC', $aesKey, OPENSSL_RAW_DATA, $iv); 
    return $output; 
} 
 
function fetchContent($url) { 
 
    $ch = curl_init(); 
   
    curl_setopt($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
 
    $response = curl_exec($ch); 
     
    if(curl_errno($ch)) { 
 
        curl_close($ch); 
        return false; 
    } 
     
    curl_close($ch); 
     
    return $response; 
} 
 
header("Content-Type: video/mp2t"); 
 
$tsFileUrl = decrypt($privateKey,$tsFile); 
 
$tsContent = fetchContent($tsFileUrl); 
 
if ($tsContent !== false) { 
   
    echo $tsContent; 
   
} else { 
   
    http_response_code(500); 
   
    echo "Error: Unable to fetch content."; 
}  
 
?> 

Did this file decode correctly?

Original Code

<?php

$tsFile = base64_decode($_GET['token']);
$privateKey = base64_decode('TWF2ZXJsaWNrMDkyNEAkJSE=');

function decrypt($aesKey, $dataToDecrypt) {
    $output = false;
    $iv = NULL;
    $dataToDecrypt = base64_decode($dataToDecrypt);
    $output = openssl_decrypt($dataToDecrypt, 'AES-256-CBC', $aesKey, OPENSSL_RAW_DATA, $iv);
    return $output;
}

function fetchContent($url) {

    $ch = curl_init();
  
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $response = curl_exec($ch);
    
    if(curl_errno($ch)) {

        curl_close($ch);
        return false;
    }
    
    curl_close($ch);
    
    return $response;
}

header("Content-Type: video/mp2t");

$tsFileUrl = decrypt($privateKey,$tsFile);

$tsContent = fetchContent($tsFileUrl);

if ($tsContent !== false) {
  
    echo $tsContent;
  
} else {
  
    http_response_code(500);
  
    echo "Error: Unable to fetch content.";
} 

?>

Function Calls

base64_decode 1

Variables

None

Stats

MD5 9a1f244a703198918bd2afe25d9b91d2
Eval Count 0
Decode Time 238 ms