Bonjour les amis,

J'ai crée une fonction qui me montre les nouveau fichiers ajouté sur le disque que je peut spécifié, mais les deux problèmes c'est que même les dossiers sont affiché sans les fichiers qui sont dedans, ainsi que les fichiers affiché sont: xxxx.txt sans le path complet

Voila le code source, merci de me démontré les trucs à changé ou y ajouté:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
 
<html>
<title>List fichiers</title>
<head>
<script  language='javascript'>
function  show_list(d)
{
   var  sInline  =  'inline';
   if  (document.getElementById(d).style.display  ==  'inline'){  sInline='none';  }
   document.getElementById(d).style.display  =  sInline;
}//end  func
</script>
</head>
<body> 
 
<?php
 
 
 
   show_list2("c:");
 
?>
 
</body>
</html>
 
<?php
 
 
 
function  show_list2($dir)
{
 
 
   echo  "<table  width=75%  cellpadding=5  cellspacing=0  align=center><tr  valign=top><td>";
 
 
   $aVids  =  array();
 
   //get  data  into  array
   //open  the  main   dir
   if  ($handle  =  opendir($dir)) 
   {
       //loop  thru  the  files  in  the  dir
       while  (false  !==  ($file  =  readdir($handle))) 
       {
           //check  to  make  sure  the  file  is  not  a  directory
           if  ($file  !=  "."  &&  $file  !=  "..") 
           {
               //reset  the  new  var  to  empty  string
               $new  =  '';
               //clear  the  stats  cache  of  file  data
               clearstatcache();
                           //get  the  file  name  and  find  out  if  its  a  new  file
                           if  (file_exists($dir.$file))
                           {
                               //check  to  see  if  the  video  is  'new'  and  needs  the  new  tag
                               if  ((time()  -  filemtime($dir.$file))  <  345600)
                               {       
                       $new  =  "\n\t\t <span  style=\"font-weight:bold;  color:red;  font-size:smaller;\">New!</span>";
                   }   
                   //add  the  video  to  the  array
                   $aVids[]  =  array('file'=>$file,  'dtime'=>filemtime($dir.$file),  'week'=>date("Y-W",filemtime($dir.$file)),  'new'=>  $new);
               }//end  if
           }//end  if
       }//loop
   }//end  if
 
 
               foreach  ($aVids  as  $key  =>  $row)  {
                     $file[$key]        =  $row['file'];
                     $week[$key]        =  $row['week'];
                     $new[$key]          =  $row['new'];
               }   
 
   //    
   array_multisort($week,SORT_DESC,$aVids);
 
   $old_week  =  0;
   $display    =  10; 
   $nCount      =  0;
   //ouvrir  table
 
//    echo  "<table  border=1>\n<tr  valign='top'><td>\n";
 
   for($x=0;  $x  <  count($aVids);  $x++)
   {
       if  (($old_week  !=  $aVids[$x]['week'])  &&  ($old_week  !=  0))
       {
           //fermer la table
           echo  "\n\t</table></div>\n";
 
           //multiple  columns
           $nCount++;
           if  (  $nCount  %  $display  ==  0  )
           {
               echo  "</td><td>";
           }
           echo  "\n<img  src='images/folder.gif'  /><a  rel=\"nofollow\" href='#'  onclick=\"show_list('"  .  $aVids[$x]['week']  .  "');\"> Week  "  .  $aVids[$x]['week']  .  "</a><br  />\n";
 
           //premier hidden
           echo  "\n\t<div  id='"  .  $aVids[$x]['week']  .  "'  >\n\t<table  border=1>";
 
           $old_week  =  $aVids[$x]['week'];
 
 
       }elseif  ($old_week  ==  0){
 
           //premièr eexecution
           echo  "\n<img  src='images/folder.gif'  /><a  rel=\"nofollow\" href='#'  onclick=\"show_list('"  .  $aVids[$x]['week']  .  "');\"> Week  "  .  $aVids[$x]['week']  .  "</a><br  />\n";
 
           //commencer un nouveau hidden
           echo  "\n\t<div  id='"  .  $aVids[$x]['week']  .  "' >\n\t<table  border=1>";
 
           $old_week  =  $aVids[$x]['week'];
       }
 
       //Afficher les elements individuel
       echo  "\n\t\t<tr><td>      <a  rel=\"nofollow\" href='"  .  $_SERVER['PHP_SELF']  .  "?v=".  $aVids[$x]['file']  .  "'>".  $aVids[$x]['file']  ."</a>";
       if  ($aVids[$x]['new']!=''){  echo    "("  .$aVids[$x]['new'].  ")</td></tr>";  }
 
 
   }//next   
   echo  "\n</td></tr></table>";
}               
?>