Odyssey
files.prg
1 <?php
2 require_once("$admLibrary/ck_aticket.i");
3 $protectdir = $home_path;
4 
5 $filename = $protectdir . $_SERVER['PATH_INFO'];
6 if (is_readable($filename)) {
7  $fileonly = basename($filename);
8  $filetype = substr($fileonly,-4);
9  if ($filetype == ".tab" || $filetype == ".zip") {
10  $s_array=stat($filename);
11  $size=$s_array["size"];
12  if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE")) {
13  header("Content-Disposition: filename=$fileonly"); // For IE
14  } else {
15  header("Content-Disposition: attachment; filename=$fileonly"); // Not IE
16  }
17  if ($filetype == ".zip") {
18  header("Content-Type: application/zip");
19  } else {
20  header("Content-type: application/octet-stream");
21  }
22  header("Content-Length: $size");
23  header("Accept-Ranges: bytes");
24 
25  }
26  readfile($filename);
27 } else {
28  header("Status: 404 Not Found");
29  print <<<EOF
30 <H1>Not Found</H1>
31 The requested URL ${_SERVER['PHP_SELF']} was not found on this server.<P>
32 <HR>
33 <ADDRESS>${_SERVER['SERVER_SIGNATURE']}</ADDRESS>
34 EOF;
35 }
36 ?>