prevents debug users from exploring system's directory structure * ex: $root = $_SERVER['DOCUMENT_ROOT']; */ $root = '/'; if( !$root ) exit("ERROR: Root filesystem directory not set in jqueryFileTree.php"); $postDir = $root.(isset($_POST['dir']) ? $_POST['dir'] : '' ); if (substr($postDir, -1) != '/') { $postDir .= '/'; } $filters = (array)(isset($_POST['filter']) ? $_POST['filter'] : ''); // set checkbox if multiSelect set to true $checkbox = ( isset($_POST['multiSelect']) && $_POST['multiSelect'] == 'true' ) ? "" : null; if( file_exists($postDir) ) { $files = scandir($postDir); $returnDir = substr($postDir, strlen($root)); natcasesort($files); if( count($files) > 2 ) { // The 2 accounts for . and .. echo ""; } } ?>