<?php
//index pages Search Engine Optimised, title, etc. will be the current dir
//"bread crumb" listing for site navigation at the top
$servername = $_SERVER['SERVER_NAME'];
$page = $_SERVER['PHP_SELF']; //get the url of the resource (webpage)
$dirs = dirname($page); //get the dirs that lead to the urls
$querystring = $_SERVER['QUERY_STRING'];
//HEAD SETUP
$title = explode("/", $page); //break the url into pieces
$currentfile = end($title); //the name of the current file (last piece)
$directory = prev($title); //find the current directory
$arr = explode("-", $directory); //break the directory name down into words
$seocontent = implode(" ", $arr); //create a string from words (with spaces)
echo "<head><title>$seocontent</title>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>";
echo "<meta name=\"description\" content=\"$seocontent\"/>\n";
echo "<meta name=\"keywords\" content=\"$seocontent\"/>\n";
echo "</head><body>\n";
/* ########## begin section on BREADCRUMBS so users can quickly navigate ######### */
$path = 'http://' . $servername;
echo '<a href="' . $path . '">' . $servername . "</a>";
echo " ";
$dirs_array = explode("/", $dirs);
for( $i=1; $i < sizeof($dirs_array); $i++ )
{
$path .= '/';
$path .= $dirs_array[$i];
echo '<a href="' . $path . '">' . "/ " . $dirs_array[$i] . "</a>";
echo " ";
}
/* ########## end section on BREADCRUMBS so users can quickly navigate ######### */
echo "<h3>$seocontent</h3>\n";
//$d = dir( getcwd() );
//echo "Handle: " . $d->handle . ", Path (not necessarily accurate): " . $d->path . "\n<br>";
//echo "<title>" . $d->path . "/</title>";
//$d->close();
$dh = opendir( getcwd() ); //get current working directory
while (false !== ($file = readdir($dh)))
{
if( $file != "." && $file != ".." ) //don't test the root directories
{
if( is_file($file) )
{ $filelist[] = $file; }
else
{ $dirlist[] = $file; }
}
}
echo "<table>\n"; //a table for our dir/file names & sizes
if( $dirlist[0] != NULL ) //maybe there are no directories
{
sort($dirlist);
foreach ($dirlist as $value)
{
echo "<tr>";
echo "<td><a href=\"" . $value . "\">" . $value . "</a></td>\n";
echo "<td> </td>";
echo "<td>" . date("dMy H:s T", filemtime($value)) . "</td>";
echo "</tr>\n";
}
}
sort($filelist);
foreach ($filelist as $value)
{
echo "<tr>";
echo "<td><a href=\"" . $value . "\">" . $value . "</a></td>";
echo "<td> </td>";
echo "<td>" . filesize($value) . " bytes</td>";
echo "<td> </td>";
echo "<td>" . date("dMy H:s T", filemtime($value)) . "</td>";
echo "</tr>\n";
}
echo "</table>";
echo "\n<br>";
echo "\n" . getcwd() . " contains " . sizeof($filelist) . " files and " .
sizeof($dirlist) . " directories\n<br>\n";
closedir($dh);
?>
<br>modified 15aug08 by john pfeiffer
<?php readfile("http://kittyandbear.net/google-code.htm"); ?>
</body>
</html>