Last active
October 22, 2015 19:31
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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