<?php
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
?>

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
	<meta name="Author" content="Juraj Videky">
	<link rel="stylesheet" type="text/css" href="/breviar.css">
	<title>CZ | Bannery</title>
</head>
<body>

<h2>CZ | Bannery</h2>

<?
/**
 * Change the path to your folder.
 *
 * This must be the full path from the root of your
 * web space. If you're not sure what it is, ask your host.
 *
 * Name this file index.php and place in the directory.
 *
 * Source: http://www.totallyphp.co.uk/scripts/directory_lister.htm
 */

// doplnil JUV/2008-10-23
// zmena JUV/2009-02-02
// clearstatcache();

// Define the full path to your folder from root
$path = "/data/www/www.breviar.sk/public_html/docs/web-banners/cz/400ppi/";

// Open the folder
$dir_handle = @opendir($path) or die("Nedokážu otevřít adresář $path");

//this is a function I wrote to sort out the contents of the directory date wise for display.
$content_array = array();

//Load Directory Into Array
$i=0;
while ($file = readdir($dir_handle))
if ($file != "." && $file != ".." && $file != "index.php" && (!fnmatch("*.ai", $file)) && (!is_dir($file)))
{
	$content_array[$i][0] = $file;
	$content_array[$i][1] = date ("Y-m-d H:i:s", filemtime($path."/".$file)); // JUV/2008-10-23, namiesto filemtime môže byť aj filectime
	$i++;
}
//close the directory handle
closedir($dir_handle);

//these lines sort the contents of the directory by the date
foreach($content_array as $res)
	$sortAux[] = $res[1];
array_multisort($sortAux, SORT_DESC, $content_array); 

//print
echo "\n<table>";
echo "\n<tr><th>Soubor</th><th>Poslední modifikace</th></tr>";
foreach($content_array as $res)
	echo "\n<tr><td><a href=\"".$res[0]."\">$res[0]</a></td><td>".$res[1]."</td></tr>";
	// $res[0].">".$res[1];

echo "\n</table>";

?>

<br>
<hr>
<center><font size=-1>Last modified: 
<? 
// doplnil JUV/2008-10-23
echo date ("Y-m-d H:i:s", filemtime($_SERVER['SCRIPT_FILENAME']));
?>

<br>© 1999-2016 <a href="mailto:videky@breviar.sk">Juraj Vidéky</a>; bannery 2016 © <a href="mailto:mail@petrkononov.com">Petr Kononov</a>.</font></center>

</body>
</html>
