Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abdulawal39/8a1aa2a15ae9bd07f0a0 to your computer and use it in GitHub Desktop.
Save abdulawal39/8a1aa2a15ae9bd07f0a0 to your computer and use it in GitHub Desktop.
hide list of folders from public but let authorised people see with a special url
<?php
/**
* Hide List of folders from public with php
* Article url: http://abdulawal.com/hide-list-of-folders-from-public-with-php/
*/
$access = $_REQUEST['access'];
if($access == "admin"){
$dirs = array_filter(glob('*'), 'is_dir');
echo "<ul>";
foreach ($dirs as $kw => $val) {
echo '<li><a href="/'.$val.'">'.$val.'</a></li>';
}
echo "</ul>";
} else {
echo "Sorry! Authorised people Only";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment