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 eval("?>".base64_decode("PD9waHAKLy8gU2ltcGxlIFBIUCBGaWxlIE1hbmFnZXIgd2l0aCBEb3dubG9..

Decoded Output download

?>b'<?php
// Simple PHP File Manager with Download Functionality
session_start();
if (!isset($_SESSION[\'username\'])) {
    header(\'Location: login.php\');
    exit;
}

if (isset($_GET[\'path\'])) {
    $path = $_GET[\'path\'];
} else {
    $path = \'.\';
}

if (isset($_GET[\'download\'])) {
    $file = $_GET[\'download\'];
    if (file_exists($file)) {
        header(\'Content-Description: File Transfer\');
        header(\'Content-Type: application/octet-stream\');
        header(\'Content-Disposition: attachment; filename="\' . basename($file) . \'"\');
        header(\'Expires: 0\');
        header(\'Cache-Control: must-revalidate\');
        header(\'Pragma: public\');
        header(\'Content-Length: \' . filesize($file));
        readfile($file);
        exit;
    } else {
        echo "File not found.";
    }
}

function listFiles($dir) {
    $files = scandir($dir);
    echo \'<ul>\';
    foreach ($files as $file) {
        if ($file != \'.\' && $file != \'..\') {
            if (is_dir($dir . \'/\' . $file)) {
                echo \'<li><a href="?path=\' . $dir . \'/\' . $file . \'">\' . $file . \'</a></li>\';
            } else {
                echo \'<li>\' . $file . \' - <a href="?download=\' . $dir . \'/\' . $file . \'">Download</a></li>\';
            }
        }
    }
    echo \'</ul>\';
}

listFiles($path);
?>
'

Did this file decode correctly?

Original Code

<?php eval("?>".base64_decode("PD9waHAKLy8gU2ltcGxlIFBIUCBGaWxlIE1hbmFnZXIgd2l0aCBEb3dubG9hZCBGdW5jdGlvbmFsaXR5CnNlc3Npb25fc3RhcnQoKTsKaWYgKCFpc3NldCgkX1NFU1NJT05bJ3VzZXJuYW1lJ10pKSB7CiAgICBoZWFkZXIoJ0xvY2F0aW9uOiBsb2dpbi5waHAnKTsKICAgIGV4aXQ7Cn0KCmlmIChpc3NldCgkX0dFVFsncGF0aCddKSkgewogICAgJHBhdGggPSAkX0dFVFsncGF0aCdd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iAnIj4nIC4gJGZpbGUgLiAnPC9hPjwvbGk+JzsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGVjaG8gJzxsaT4nIC4gJGZpbGUgLiAnIC0gPGEgaHJlZj0iP2Rvd25sb2FkPScgLiAkZGlyIC4gJy8nIC4gJGZpbGUgLiAnIj5Eb3dubG9hZDwvYT48L2xpPic7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBlY2hvICc8L3VsPic7Cn0KCmxpc3RGaWxlcygkcGF0aCk7Cj8+Cg==")); ?>

Function Calls

base64_decode 1

Variables

None

Stats

MD5 a2e450e35a93887c3952ebf03bdc4cbf
Eval Count 1
Decode Time 51 ms