I haven't tested this, but try this:
$current_dir = 'uploads/';
$dir = opendir($current_dir);
$disallow=array('privatedir1','privatedir2','privatedir3');
echo "<p>Upload directory is $current_dir<br />";
echo 'Directory Listing:</p><hr /><p>';
while ($file = readdir($dir)){
if (($file != '.' || $file != '..') && (!in_array($file,$disallow))){
echo "$file<br />";
}
}
echo '</p><hr />';
closedir($dir);
I have added an array to hold the names of all the folders you wish to 'protect', and added a check to if to see if the latest $file-variable matches any of the entries in this array...
Hope it works 🙂