index.php 841 B

123456789101112131415161718192021222324
  1. <?PHP
  2. require "../init.inc";
  3. $SOUND_PATH = APP_DATA_PATH . DIRECTORY_SEPARATOR . "sound";
  4. $fileName = filter_input(INPUT_GET, "fn")??"";
  5. $fileName = strip_tags($fileName);
  6. $originalFilename = pathinfo($fileName, PATHINFO_FILENAME);
  7. $orioriFilename = explode("|", $originalFilename)[2];
  8. $originalFileExt = pathinfo($fileName, PATHINFO_EXTENSION);
  9. $fileExt = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
  10. $filePath = $SOUND_PATH . DIRECTORY_SEPARATOR . $fileName;
  11. if (filesize($filePath) <= APP_FILE_MAX_SIZE) {
  12. header("Content-Type: audio/" . $fileExt);
  13. header("Content-Disposition: attachment; filename=" . $orioriFilename . ".$fileExt");
  14. echo(file_get_contents($filePath));
  15. exit(0);
  16. } else {
  17. die("file size over app limits.");
  18. }