<?php

function readFolders($dir,$level=0){
    $level++;
    $indent = $level*20;
    
    $opendir = opendir($dir);//opens a folder for reading
$nonos = ['.','..','error_log','emails.txt'];
while ($file = readdir($opendir))
    { 
    if (in_array($file,$nonos)) continue;
    //if something is a directory
    echo '<p style="margin-left:'.$indent.'px">';
    if (is_dir($file)){
     echo '<strong>'.$file.'</strong><br>';  
       readFolders($file,$level);        
    }
    else {
    echo '<a href="'.$file.'" target="blank">'.$file.'</a><br>';
    }
    echo '</p>';
    }
}
readFolders('.');




?>