toxictoad
12-08-2008, 01:03 AM
Hi all,
I've got this script working and it displays the contents of the folder.
I was wondering if someone could show me what I need to add to hide .php files from being displayed?
<?php
$dir = "http://mysite.com/files/uploads/";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo "filename: $file : filetype: " . filetype($dir . $file) . "/n";
}
closedir($dh);
}
}
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file<br />";
}
}
closedir($handle);
}
?>
I am really new to php and I'm trying to piece things together so if you could provide and example that would be of a great help.
Thanks
TT
I've got this script working and it displays the contents of the folder.
I was wondering if someone could show me what I need to add to hide .php files from being displayed?
<?php
$dir = "http://mysite.com/files/uploads/";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo "filename: $file : filetype: " . filetype($dir . $file) . "/n";
}
closedir($dh);
}
}
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file<br />";
}
}
closedir($handle);
}
?>
I am really new to php and I'm trying to piece things together so if you could provide and example that would be of a great help.
Thanks
TT