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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TITRE DE LA PAGE</title>
<style>
body {
color: #000000;
background-color: #FFFFFF;
margin:10px ;
padding:0px 0px 0px 0px;
font-size: 76%;
font-family: verdana, arial, helvetica, sans-serif;
}
h1, h2, h3, h4, h5, h6 {
color: #000000;
margin:0px 0px 15px 0px;
padding:0px 0px 0px 0px;
font-family: Verdana, arial, helvetica, sans-serif;
}
h1 {font-size: 1.8em;}
h2 {font-size: 1.6em;}
p { font-size: 1em; }
/* for i.e */
table {font-size: 1em;}
table, tr, td, th {margin:0px 0px 0px 0px;}
.directory, .directory a:link {background-color: #888888; color: #ffffff; }
th {background-color: #336699; color: #ffffff; }
th a:link {color: #ffffff; text-decoration: none; }
th a:visited {color: #ffffff; text-decoration: none; }
th a:hover {background-color: #336699; color: #000000;}
a { font-size: 1em; text-decoration:none; }
a:link {color: #0000cc;}
a:visited {color: #0000cc;}
a:hover {background-color: #336699; color: #FFFFFF;}
dt { font-weight: bold; }
code {font-size: 120%;}
pre {font-size: 120%;}
</style>
</head>
<body>
<?php
function format_bytes($bytes) {
if ($bytes < 1024) return $bytes.' B';
elseif ($bytes < 1048576) return round($bytes / 1024, 2).' KB';
elseif ($bytes < 1073741824) return round($bytes / 1048576, 2).' MB';
elseif ($bytes < 1099511627776) return round($bytes / 1073741824, 2).' GB';
else return round($bytes / 1099511627776, 2).' TB';
}
// open this directory
$myDirectory = opendir(".");
// get each entry
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}
// close directory
closedir($myDirectory);
// count elements in array
$indexCount = count($dirArray);
Print ("$indexCount fichiers<br>\n");
// sort 'em
sort($dirArray);
// print 'em
print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n");
print("<TR><TH>Nom du fichier</TH><th>Extension</th><th>Taille</th></TR>\n");
// loop through the array of files and print them all
$hidden_extensions = array(".html", ".htm", ".php", ".css");
for($index=0; $index < $indexCount; $index++) {
$filename=$dirArray[$index];
$extension=strtolower(substr ($filename, strrpos ($filename, '.')));
$filesize = filesize($dirArray[$index]);
$filetype = filetype($dirArray[$index]);
if (! in_array($extension,$hidden_extensions) && substr("$filename", 0, 1) != "." ) { //cacher les fichiers système && $filetype !="dir"
if ($filetype =="dir") {
print("<TR class='directory'><TD ><a href=\"$filename\">".strtoupper($filename)."</a></td>");
print("<td>");
//print();
print ("REPERTOIRE");
print("</td>");
print("<td>");
print(" ");
print("</td>");
print("</TR>\n");
}
else{
print("<TR><TD><a target='_blank' href=\"$filename\">$filename</a></td>");
print("<td>");
//print();
print ($extension);
print("</td>");
print("<td>");
print(format_bytes($filesize));
print("</td>");
print("</TR>\n");
}
}
}
print("</TABLE>\n");
?>
</body>
</html> |