require_once("eprConst.inc"); require_once("eprUtil.inc"); // epr 実行結果をダウンロードさせる $f = $_GET['f']; $regexp = "=^(" . EPR_OUT_DIR . '[0-9]{8}_[0-9]{6}_[0-9]{8}|' . INP_URL . '(' . join('|', $CATEGORY_LIST) . ')/([^/]+))/([^/]+\.(inp|out|plt|INP|OUT|PLT))$='; // (000|inpurl(c1|c2)/(folder)/(finename.(inp|out|plt))) // 1 2 3 4 5 if (! preg_match($regexp, $f, $matches) || ! is_readable(EPR_ROOT . $f)) { // echo "
" . $regexp . "\n"; // echo "$f\n"; echo "error: file '$f' not found."; exit; } $fileName = $matches[4]; if ($matches[2]) { $category = $matches[2]; $folder = $matches[3]; $inpRunDownTable = getInpRunDownloadData(); $inpRunDownTable[$category . "/" . $folder . "/" . $fileName]['down']++; writeInpRunDownloadData($inpRunDownTable); } header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header('Content-Description: File Transfer'); header("Content-Type: application/octet-stream"); header("Content-Length: " . (string)(filesize(EPR_ROOT . $f))); header("Content-Disposition: attachment; filename=\"{$fileName}\""); //header("Content-Length: ".$content_length); $content = file(EPR_ROOT . $f); foreach ($content as $line) { echo $line; } ?>