<textarea>
  <?php
  echo file_get_contents($_GET['file']);  
  ?>    
    
</textarea>     
<?php
error_reporting(0);
    // Open a known directory, and proceed to read its contents

function recurse($dir,$levels = 0){
   
    $marginleft = $levels * 20;
    echo 'levels are '.$levels.'<br>'; 
      if ($dh = opendir($dir)) {
         sort($dh);
            while (($file = readdir($dh)) !== false) {
                
                if ($file == '.' || $file== '..' || $file == '.DS_Store') continue;
                if (is_dir($dir.'/'.$file)){
                    $path = $dir.'/'.$file;
                    $slashes = count(explode('/',$path)) - 1;
                    echo 'Directory: '.$dir.'/'.$file.'<br>';
                    recurse($dir.'/'.$file,$slashes);
                }
                else {
               //test folder...if it is a directory call function and send new path
                //else
             echo   '<span style="margin-left: '.$marginleft.'px;"><a href="'.$file.'">Visit '.$file.'</a>'; 
             if (getimagesize($dir.'/'.$file)){
                echo '<img src ="'.$dir.'/'.$file.'" height="50">'; 
             }
                    
             if (strpos($file,'.php')){
             echo '<a href="cms.php?file='.$dir.'/'.$file.'"> Edit '.$file.'</a>';
             }
            echo  '</span><br>';        
                    
             
                }
             }
           
            closedir($dh);
        }
    }

recurse('.');
?>
   

  