File indexing completed on 2024-04-06 12:23:16
0001 <?php
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 function send_file($path) {
0037 ob_end_clean();
0038 if (preg_match(':\.\.:', $path)) { return(FALSE); }
0039 if (! preg_match(':^plotcache/:', $path)) { return(FALSE); }
0040 if (!is_file($path) or connection_status()!=0) return(FALSE);
0041
0042 header("Cache-Control: no-store, no-cache, must-revalidate");
0043 header("Cache-Control: post-check=0, pre-check=0", false);
0044 header("Pragma: no-cache");
0045 header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT");
0046 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
0047 header("Content-Type: application/octet-stream");
0048 header("Content-Length: ".(string)(filesize($path)));
0049 header("Content-Disposition: inline; filename=".basename($path));
0050 header("Content-Transfer-Encoding: binary\n");
0051 if ($file = fopen($path, 'rb')) {
0052 while(!feof($file) and (connection_status()==0)) {
0053 print(fread($file, 1024*8));
0054 flush();
0055 @ob_flush();
0056 }
0057 fclose($file);
0058 }
0059 return((connection_status()==0) and !connection_aborted());
0060 }
0061 ?>
0062
0063 <?php
0064 if (!isset($_GET['file'])) { exit; }
0065
0066 if (!send_file($_GET['file'])) {
0067 die ("File transfer failed");
0068
0069
0070 } else {
0071
0072
0073 }
0074 ?>