Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Optimizacija scripti

[es] :: PHP :: Optimizacija scripti

[ Pregleda: 1885 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

NenadS
Nenad Strainovic
Beograd

Član broj: 857
Poruke: 910
*.smin.sezampro.yu.

Sajt: www.strainovic.com


+7 Profil

icon Optimizacija scripti21.01.2005. u 06:55 - pre 234 meseci
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 :)
Pozdrav, NenadS!
 
Odgovor na temu

NenadS
Nenad Strainovic
Beograd

Član broj: 857
Poruke: 910
195.252.80.*

Sajt: www.strainovic.com


+7 Profil

icon Re: Optimizacija scripti22.01.2005. u 06:50 - pre 234 meseci
Mozete da izbrisete ovu temu, scripte su optimizovane i rade super.

thx
Pozdrav, NenadS!
 
Odgovor na temu

[es] :: PHP :: Optimizacija scripti

[ Pregleda: 1885 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.