Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Lista plików
kyku
post
Post #1





Grupa: Zarejestrowani
Postów: 116
Pomógł: 8
Dołączył: 21.11.2008

Ostrzeżenie: (0%)
-----


Witam. Posiada ktos funkcje ktora by pobrala liste wszystkich plikow na FTP?
Znalazlem pelno funkcji lecz wszystkie pobieraly tylko z jednego folderu
np taka
Kod
function e_dir($dir_url, $rozszerzenia)
{
if ($dir =@opendir($dir_url)) {
  while ($file = readdir($dir)) {

   $t_file=explode(".", "$file");
   $roz=$t_file[count($t_file)-1];
  
   if((!is_dir($dir_url."/".$file))&&($file != '.')&&($file != '..')&&(in_array($roz, $rozszerzenia))) {
    $pliki[] = $file;
  
   }
  }
  closedir($dir);
}
return $pliki;
}

z góry dziękuje za pomoc

Ten post edytował thek 29.04.2010, 00:08:42
Powód edycji: [thek]: Proszę o właściwy BBCode
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
AndyPSV
post
Post #2





Grupa: Zarejestrowani
Postów: 393
Pomógł: 5
Dołączył: 6.02.2003
Skąd: The.Luciferian.Doctrine.p
df

Ostrzeżenie: (30%)
XX---


  1. function list_dir($pth) {
  2. loadLib('time');
  3. $x = '
  4. <div id=\'idx\'>
  5. <table>
  6. <tr>
  7. <td class=\'b\'>&nbsp;#</td>
  8. <td class=\'b w12_\'>Filename</td>
  9. <td class=\'b\'>Modified</td>
  10. </tr>
  11.  
  12. <tr>
  13. <td colspan=\'3\'></td>
  14. </tr>
  15. '; $path[0] = URL.'v/'.$this->u['id'].'/'; $_name = _PATH.'v/'.$this->u['id'].'/';
  16.  
  17.  
  18. $i = 0; if($h = opendir($pth)) {
  19. while(false !== ($f = readdir($h))) {
  20. if($f <> '.' and $f <> '..' and substr($f,0,4) <> IMG_TH and substr($f,0,8) <> IMG_AV)
  21. if(is_readable($pth.$f))
  22. if(!is_dir($pth.$f)) {
  23. $stat = stat($pth.$f);
  24. $item['size'] = sprintf("%.2f",$stat['size']/1000); if($this->u['status'] == 'admin') $_acc = 1; else $_acc = 0;
  25. $q = q('SELECT * FROM `'.PRFX.'imgs` WHERE id_u = "'.$this->u['id'].'" AND t = "'.$f.'" LIMIT 1'); if(n_r($q) == 0) q('INSERT INTO `'.PRFX.'imgs` (id,id_u,t,date,acc) VALUES (NULL,'.$this->u['id'].',"'.$f.'","'.DATETIME.'","'.$_acc.'");'); else $f_ = f($q);
  26. if($f_['acc'] == 1) $acc = ''; else { $acc = 'n'; $acc_ = 'image waiting for acceptation'; }
  27.  
  28. $x .= '<tr class=\'v\''; if($this->u['avatar'] == $f) $x .= 'style=\'background-color:#ccc\' '; $x .= 'onclick=\'java script:_get("pic","'.$f.'");\'>
  29. <td valign=\'top\' id=\'acc\' title=\''.$acc_.'\'><img src=\''.TPL.'img/dir/'.$acc.'file.gif\' /></td>
  30. <td valign=\'top\'><div class=\'fl\'><a href=\'#\' onclick=\'java script:_get("pic","'.$f.'");\'>'.$f.'</a><div class=\'clearfix\' id=\''.$i.'\' style=\'display:none;\'>Do you want to delete picture?&nbsp;&nbsp;&nbsp;&nbsp;<a href=\''.URL.'profile/photo/d/'.$f.'\'>Yes</a>&nbsp;&nbsp;<a href=\''.URL.'profile/photo/\'>No</a></div></div><div class=\'fr\'>'.$item['size'].'kb&nbsp;&nbsp;&nbsp;&nbsp;</div></div class=\'fix\'></div></td>
  31. <td valign=\'top\'>'._ago($stat['mtime']).' ago</td>
  32. <td valign=\'top\' class=\'sp4\'><!--<img src=\''.TPL.'img/ico/del2.gif\' class=\'pointer\' id=\'pp'.$i.'\' alt=\'delete picture\' />--> <a href=\''.URL.$f_['id'].'\'>&rarr;</a></td>
  33. </tr>
  34. <script type=\'text/javascript\'>$(document).ready(function(){$("#pp'.$i.'").click(function(){$("#'.$i.'").toggle("slow")})});</script>';
  35. $i++;/*$this->u['id'].'/p/'.substr($f,0,-4).'*/
  36.  
  37. if(!file_exists($_name.IMG_TH.$f)) {
  38. $x .= "<img src=\"".URL.DIR_LIB.'thumb/'.INX.PHP.'?f='.$path[0].$f.'&w='.IMG_X.'&h='.IMG_Y.'&id='.$this->u['id'].'&t='.$f.'&pre=th" width="1" height="1" alt="" />';
  39. # CREATES AVATAR AUTO. $x .= "<img src=\"".URL.DIR_LIB.'thumb/'.INX.PHP.'?f='.$path[0].$f.'&w='.IMG_X.'&h='.IMG_Y.'&id='.$this->u['id'].'&t='.$f.'&pre=avatar" width="1" height="1" alt="" />';
  40. }
  41. }
  42. } closedir($h);
  43. } $x .= '</table></div>'; return $x;
  44. }
  45.  
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 10.10.2025 - 03:50