salve e buon pomeriggio sto tentando di rendere visibile la sottocartella con il nome della sessione username ( ogni utente registrato ha una cartella con il suo nome si trova in documenti/ ) ho provato a inserire directori strtolower username alla fine del codice ma mi da due errori 84 86 chiedo aiuto grazie
Codice:
<?PHP
// Define a function to list files and subfolders
function list_files($dir) {
// Get an array of files and subfolders
$files = scandir($dir);
// Loop through the array
foreach ($files as $file) {
// Skip the current and parent directories
if ($file != "." && $file != "..") {
// Get the full path of the file or folder
$path = $dir . "/" . $file;
// Check if it is a file
if (is_file($path)) {
// Get the file name
$name = basename($path);
// Encode the file path
$url = urlencode($path);
// Create a download link
echo "Documento: <a href='download.php?file=$url'>$name</a><br>";
}
// Check if it is a folder
if (is_dir($path)) {
// Print the folder name
echo "Cartella: <b>$file</b><br>";
// Call the function recursively
list_files($path);
}
}
}
}
// Call the function with the main directory
list_files("documenti".strtolower($username));
?>