download.php 927 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * 导出文件代理
  4. *
  5. * @author Jinqn, techird
  6. */
  7. $type = $_REQUEST['type'];
  8. if (isset($_REQUEST['content'])) {
  9. $content = $_REQUEST['content'];
  10. if ($type == 'base64') {
  11. $content = base64_decode($content);
  12. }
  13. $filename = htmlspecialchars($_REQUEST["filename"]);
  14. if (!$filename) {
  15. $filename = "kikyminder";
  16. }
  17. if (isset($_REQUEST['iehack'])) {
  18. $filename = urlencode($filename);
  19. }
  20. header("Content-type: application/octet-stream; charset=utf8; name=".urlencode($filename));
  21. header("Accept-Length: ".strlen($content));
  22. header("Content-Length: ".strlen($content));
  23. header("Content-Disposition: attachment; filename=".$filename);
  24. header('Content-Description: File Transfer');
  25. if (isset($_REQUEST['stamp'])) {
  26. setcookie($_REQUEST['stamp'], 1, time() + 30);
  27. }
  28. echo $content;
  29. } else {
  30. echo 'Empty Content!';
  31. }
  32. ?>