[ NenadS @ 21.01.2005. 06:55 ] @
Moze li mi neko pomoci oko optimizacije scripti, jedna je za dir listing, a druga za pretragu... Code: $dh = @opendir($dir); while (false !== ($file = @readdir($dh))) { if($file != "." && $file != ".." && strpos($file,'.jpg') != 0 && $file != substr($PHP_SELF, -(strlen($PHP_SELF) - strrpos($PHP_SELF, "/") - 1))){ if("$file" !== ""){ $k++; $key = $k; $files[$key] = $file; } } } if(empty($files)){ $isempty = "yes"; } if(!$isempty){ @natcasesort($files); $files = @array_values($files); $arsize = sizeof($files); for($i=0;$i<$arsize;$i++) { echo "<li><A HREF=\"$path/$files[$i]\"><font color=\"white\"><b>$files[$i]</b></font></A></li>\n"; } } i Code: function recursedir($path) { global $search; $hndl=opendir($path); while($file=readdir($hndl)) { if ($file=='.' || $file=='..') continue; $completepath="$path/$file"; if (is_dir($completepath)) { # its a dir, recurse. recursedir($path.'/'.$file); } else { if (@eregi("$search", $file ) && strpos($file,'.jpg') != 0) { $file =$file; # its a file. print "<li><A HREF=\"$path/$file\"><font color=\"white\"><b>$file</b></font></A></li>\n"; } } } } if ($search && strlen($search) > "2") { recursedir($path); } Svaka pomoc je dobro dosla :) |