SHARE
TWEET

Untitled

a guest Aug 17th, 2013 2,112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. if (isset($_GET['img'])) {$filename = $_GET['img'];}else{exit;}
  3. $allowed = array('gif','png','jpg');
  4. $ext = pathinfo($filename, PATHINFO_EXTENSION);
  5. if(!in_array($ext,$allowed)) {exit;}
  6. $stc = 31536000;
  7. $ts = gmdate("D, d M Y H:i:s", time() + $stc) . " GMT";
  8. header('Content-Type: application/octet-stream');
  9. header('Content-Disposition: attachment; filename=' . basename($filename));
  10. header('Content-Transfer-Encoding: binary');
  11. header("Expires: $ts");
  12. header("Cache-Control: max-age=$stc, public");
  13. header("Pragma: cache");
  14. ob_clean();
  15. flush();
  16. readfile($filename);
  17. exit;
  18. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top