Hy , i have flash file wich loads php file and php file creates virtual xml in flash, php file scan folder sub folders and sub-files and creates virtual xml list.. after that flash reads it.. every thing works fine but i want to ignore some file types and i put this code but it doesn't works
$exts = array( '.db', '.ini' );
here is my full code
<?php
function getDirectory( $path = '.', $level = 1 ){
// Directories to ignore when listing output. Many hosts
// will deny PHP access to the cgi-bin.
$ignore = array( 'cgi-bin', '.', '..', "_notes" );
// File extensions to ignore
$exts = array( '.db', '.ini' );
// Open the directory to the handle $dh
$dh = @opendir( $path );
// Loop through the directory
while( false !== ( $file = readdir( $dh ) ) ){
// Check that this file is not to be ignored
if( !in_array( $file, $ignore ) ){
// Just to add spacing to the list, to better show the directory tree.
$spaces = str_repeat( ' ', ( $level * 5 ) );
// Its a directory, so we need to keep reading down...
if( is_dir( "$path/$file" ) ){
// echo "<strong>$spaces $file</strong><br />";
echo $spaces . "<name label=\"$file\" >\n";
// Re-call this same function but on a new directory.
// this is what makes function recursive.
getDirectory( "$path/$file", ($level+1) );
echo $spaces . "</name>\n";
} else {
// Just print out the filename
// echo "$spaces $file<br />";
echo $spaces . "<fname url=\"$path/$file\" label=\"" . $file . "\" />\n";
}
}
}
closedir( $dh );
// Close the directory handle
}
$dir = "files/";
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<FileFolder>\n";
// Get the current directory
getDirectory($dir);
echo "</FileFolder>"
?>
please help me to correct this code, i want to ignore .db , .ini file types but no luck