<?php
/**
* Download script
*
* By S.E.
*/
//Path prevent
require_once("fonc.php");
//Display path
$path = "";
//Get the download path
if(isset($_GET['path']))
$path = $_GET['path'];
if(isset($_POST['path']))
$path = $_POST['path'];
//Protect path
$path = path_prevent($path, "file");
//If we can't find this file
if(!$path || !file_exists($path))
header("Location: /40X/404.php");
//Else
//File name
$filename = basename($path);
//Xml
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml" />
<link rel="stylesheet" type="text/css" href="../style.css" media="screen" />
<title>Display : <?php echo $filename; ?></title>
</head>
<body class="explode">
<h1>File : <?php echo $path; ?></h1>
<p class="display">
<?php
$data = file_get_contents($path);
$ext = strrchr(basename($path), ".");
if($ext == ".php")
highlight_string($data);
else
echo nl2br(htmlentities($data));
?>
</p>
<hr />
<p>
<a href="http://validator.w3.org/check?uri=referer">
<img src="http://www.w3.org/Icons/valid-xhtml11-blue"
alt="Valid XHTML 1.1" height="31" width="88" />
</a>
</p>
</body>
</html>