head 1.1; access; symbols; locks; strict; comment @# @; 1.1 date 2006.03.14.17.00.41; author rse; state Exp; branches; next ; commitid novA3CyEjNP0Gapr; desc @@ 1.1 log @many cleanups and more documentation @ text @ "text/plain", "cfg" => "text/plain", "*" => "application/octet-stream", ); $file = $_GET["file"]; if (!preg_match('/^[^\/\s]+$/s', $file)) die("invalid file name: " . $file); if (!is_file($file))// die("invalid file: " . $file); $ext = ""; if (preg_match('/\.([^.]+)$/', $file, $match)) $ext = $match[1]; $content = file_get_contents($file); $t = isset($type[$ext]) ? $type[$ext] : $type["*"]; header(sprintf("Content-Type: %s", $t)); header(sprintf("Content-Length: %d", strlen($content))); print $content; ?> @