well the code above is almost doing it
the only problem is that urlencode() uses "+" for spaces
and apache has problems finding the files that way
that's why i added a line replacing the + with spaces
here is the final code
it lists all .php files in a directory without the sub-directories, and does not have problem regardless there are filenames in cyrillic or not. Exactly what i needed.
<?php
$path='/path/bla/bla/' ;
if ( $dh = @opendir($path) )
{
while ( false !== ( $file = readdir($dh) ) )
{
if (strpos($file, ".php")) {
if ( $file != '.' && $file != '..' && $file != 'index.php')
{
$catch[] = $file;
}
}
}
}
for ($a=0; $a<=count($catch);$a++) {
$temp=$catch[$a];
$temp2=urlencode($temp);
$temp2=str_replace("+"," ", "$temp2");
echo " <a href=\"$temp2 \">$catch[$a]</a><br>";
}
?>
the purpose i use it for, is indexing a files, by a site se, which are not linked anywhere...