Bonjour,

Je souhaite lister une arborescence FTP sur un site, selon certaine conditions :

- Très rapide de chargement
- Script encastrable dans une page très légèrement (pas 200.000 fichiers)
- Permettre dans le même encart de naviguer dans la sous arborescence et pourvoir télécharger en cliquant simplement
- Etre assez propre, pas besoin de superflu, juste besoin du nom du fichier/dossier, et la taille, peut être la date de modification.

Par contre, je n'ai pas besoin du tout de gestion d'upload ou de modifications, bien au contraire.

J'ai trouvé un script léger et réactif qui s'appelle ExplorerXP, qui fait ce que je cherche MAIS dans l'arborescence locale et non distante et FTP.

Le fichier principal est dir.php, que voici :

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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?
// Vous pouvez changer le chemin de départ, par default "." //
$depart="/";
 
 
// ----- Affiche arborescence ----- Auteur : fgauharou@yahoo.fr ------------- //
 
require("./fonctions.php");
 
// ------------------------------ Initialisation des variables ----------------------------------------------- //
 
 
if(!empty($chemin))     $chemin     = stripslashes($chemin); else $chemin = $depart;
echo $chemin;
 
 
// ----------------------------------- Sécurité navigation -------------------------------------------------- //
 
$chemintotal = $chemin;
 
// ------------------------------- Récupération des fichiers et répertoires dans tableau-- //
 
 
$handle  = @opendir($chemintotal);
$file    = @readdir($handle);      // repertoire .
$file    = @readdir($handle);      // repertoire ..
$repind  = 0;
$fileind = 0;
 
while ($file = @readdir($handle))
{
	if(is_dir("$chemintotal/$file"))
	{
		$reptab[$repind]["nom"]           = $file;
		$reptab[$repind]["taille"]        = filesize("$chemintotal/$file");
		$repind++;
	}
	else
	{
		$filetab[$fileind]["nom"]         = $file;
		$filetab[$repind]["taille"]        = filesize("$chemintotal/$file");
		$fileind++;
	}
}
 
@closedir($handle);
 
 
 
// ============================= Affichage =================================== //
?>
 
<! ----------------------- Affichage du chemin ------------------>
<table width=50% border="0" cellspacing="0" cellpadding="0" BGCOLOR="#b0bace">
  <tr>
    <td><b><? echo " Chemin : ";?></b><?$CheminDecompose = DecomposerChemin($chemin);echo $CheminDecompose; // -- Affiche le dossier courant -- // ?>
  </td>
  </tr>
</table>
 
<TABLE WIDTH="650" BORDER="0" CELLPADDING="0" CELLSPACING="1" nowrap>
<TR>
	<TD background="/images/menu.jpg" width=35>&nbsp;</TD>
	<TD background="/images/menu.jpg" ALIGN="center"><b><? echo "Nom"; ?></b></TD>
	<TD background="/images/menu.jpg" width=65 ALIGN="center" COLSPAN="5"><B><? echo "Taille"; ?></B></TD>
</TR>
<TR><TD COLSPAN="10"><HR NOSHADE></TD></TR>
 
<? 
// ------ Si on clique sur dossier parent --------------- //
 
if($chemin != ".")
{
	$cheminretour = ModifChemin($chemin);
	$cheminretour = rawurlencode($cheminretour);
 
	?>
	<TR>
		<TD width=35 ALIGN="center"><A HREF="./dir.php?chemin=<? echo $cheminretour; ?>"><IMG SRC="./images/back.gif" BORDER="0"></A></TD>
		<TD ALIGN="left"  ><A HREF="./dir.php?chemin=<? echo $cheminretour; ?>">..</A></TD>
	</TR>
	<?
}
 
 
// -------------------------------------- Affichage des répertoires --------------------------------------- //
 
for($i=0;$i<$repind;$i++)
{
	$nomrep      = $reptab[$i]["nom"];
	$cheminrep   = rawurlencode($chemin."/".$nomrep);
	$IndiceImage = $i;
	$pair	     = $i%2;
	?>
	<TR>
		<TD <? if ($pair==1) {echo "";?>BGCOLOR="#b0bace" bordercolor="#b0bace"<?} else {echo "";?>BGCOLOR="#d8dde7" bordercolor="#d8dde7"<?}?> ALIGN="center"><A HREF="./dir.php?chemin=<? echo $cheminrep; ?>"><IMG SRC="./images/dir.gif" border="0"></A></TD>
		<TD <? if ($pair==1) {echo "";?>BGCOLOR="#b0bace" bordercolor="#b0bace"<?} else {echo "";?>BGCOLOR="#d8dde7" bordercolor="#d8dde7"<?}?> ALIGN="left" ><font color="#000099"><font face=" Verdana,Arial, Helvetica, sans-serif" size="2"><? echo $nomrep; ?></TD>
		<TD <? if ($pair==1) {echo "";?>BGCOLOR="#b0bace" bordercolor="#b0bace"<?} else {echo "";?>BGCOLOR="#d8dde7" bordercolor="#d8dde7"<?}?> ALIGN="left" ><font color="#000099"><font face=" Verdana,Arial, Helvetica, sans-serif" size="2"></TD>
 
	</TR>
	<?
}
 
// --------------------------------------- Affichage des fichiers ----------------------------------------- //
 
$IndiceImage++;
 
 
for($i=0;$i<$fileind;$i++)
	{
	$nomfic      = $filetab[$i]["nom"];
	$ext         = GetExtension($nomfic);
	$ext         = strtolower($ext);
	$icone       = GetIcone($ext);
	$IndiceImage = $i;
	$pair	     = $i%2;
 
	?>
	<TR>
		<TD <? if ($pair==1) {echo "";?>BGCOLOR="#F2F4F7" bordercolor="#F2F4F7"<?} else {echo "";?>BGCOLOR="#EBEEF3" bordercolor="#EBEEF3"<?}?>width=35 ALIGN="center"><IMG SRC ="./images/<? echo $icone ?>"></TD>
		<TD <? if ($pair==1) {echo "";?>BGCOLOR="#F2F4F7" bordercolor="#F2F4F7"<?} else {echo "";?>BGCOLOR="#EBEEF3" bordercolor="#EBEEF3"<?}?>ALIGN="left"  ><A HREF="<? echo $chemin."/".$nomfic; ?>"><? echo $nomfic ; ?></A></TD>
		<TD <? if ($pair==1) {echo "";?>BGCOLOR="#F2F4F7" bordercolor="#F2F4F7"<?} else {echo "";?>BGCOLOR="#EBEEF3" bordercolor="#EBEEF3"<?}?>ALIGN="right"  ><? echo FormatTailleFichier(filesize($chemin."/".$nomfic)); ?></TD>
	</TR>
	<?
	}
 
// ------ fin du tableau ---- //
 
?>
<TR><TD COLSPAN="10"><HR NOSHADE></TD></TR>
</TABLE><BR>
 
 
<! --------- Affiche le nombre de dossiers et de fichiers -------------- >
 
 
<table width=400 border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td background="/images/menu.jpg"><B>
	<? echo " Nombre de dossier(s) : ".$repind; ?> - <? echo " Nombre de fichier(s) : ".$fileind; ?></B>
	</td>
  </tr>
</table>
 
</BODY>
</HTML>
Je souhaiterais l'adapter au listing d'un serveur FTP de type :
ftp://log:pass@serveurFTP:21

Pouvez vous m'aider ? J'ai beau essayer, je bloque grave.