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
|
<body>
<div id='container'>
<br/>
<h1>Home Page</h1>
<img src='logo_blue.png' style='margin-left:0%; margin-top:-7%; width: 17%;''>
<table class='table table-hover '>
<thead>
<tr>
<th>FILENAME</th>
<th>DATE MODIFIED</th>
<th>TITLE WEBSITE</th>
</tr>
</thead>
<tbody>";
// Opens directory
$myDirectory=opendir(".");
// Gets each entry
while($entryName=readdir($myDirectory)) {
$dirArray[]=$entryName;
}
// Finds extensions of files
function findexts ($filename) {
$filename=strtolower($filename);
$exts=explode(" ", $filename);
$n=count($exts)-1;
$exts=$exts[$n];
return $exts;
}
// Closes directory
closedir($myDirectory);
// Counts elements in array
$indexCount=count($dirArray);
// Find title and file inside the folder
$fileList = glob('tpe*/index.html');
$array = array();
$array2 = array();
foreach($fileList as $file_title){
$html = file_get_contents($file_title);
preg_match("/<title>([^<]*)<\/title>/im", $html, $matches);
array_push($array, $matches[1]);
}
// Loops through the array of files
for($index=0; $index < $indexCount; $index++) {
// Allows ./?hidden to show hidden files
if($_SERVER['QUERY_STRING']=="hidden")
{$hide="";
$ahref="./";
$atext="Hide";}
else
{$hide=".";
$ahref="./?hidden";
$atext="Show";}
if(substr("$dirArray[$index]", 0, 1) !== $hide) {
// Gets File Names
$name=$dirArray[$index];
// Gets Date Modified Data
$modtime=date("Y-m-d H:i", filemtime($dirArray[$index]));
// Display table with all information *
if ($index >= $name){
$ind = $index - $name;
print("
<tr>
<td><a href='./'>$name</a></td>
<td><a href='./'>$modtime</a></td>
<td><a href='./'>$array[$ind]</a></td>
</tr>");
}
}
}
echo"
</tbody>
</table>
</div>
</body> |
Partager