<?php

// showfiles.php
// by Daniel Lyons

// this unset prevents "register_globals" attacks, Bill and I think.
unset ($files);

// we use this array to ensure that the file requested is valid.
// Jarrod: you're going to have to add files to this array whenever you update
// the directory if you want people to be able to see 'em
$files = array('fiction.txt', 'liff.txt', 'logout.txt', 'nonfiction.txt', 'people.txt', 'pinstrt.txt');

// if we don't have an argument named 'file', or if that argument doesn't name a
// file listed in the array above, show them the "fuck off" page
if (!isset($_GET['file']) || !in_array($_GET['file'], $files))
{
	include('forbidden.html');
	exit();
}

?>

<html>
	<head>
		<title><?= $file ?></title>
		<link rel="stylesheet" href="quotes.css">
	</head>
	<body>
		<pre>
<? include ($_GET['file']) ?>
		</pre>
	</body>
</html>
