Skip to content

Instantly share code, notes, and snippets.

@jonmaim
Created September 16, 2011 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonmaim/1221124 to your computer and use it in GitHub Desktop.
Save jonmaim/1221124 to your computer and use it in GitHub Desktop.
Really unsecure php image proxy.
<?php
$filename = $_GET['url'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
switch ($ext) {
case "gif":
header('Content-Type: image/gif');
readfile($filename);
break;
case "png":
header('Content-Type: image/png');
readfile($filename);
break;
case "jpg":
default:
header('Content-Type: image/jpeg');
readfile($filename);
break;
}
?>
@jonmaim
Copy link
Author

jonmaim commented Sep 16, 2011

@hackerpro536
Copy link

how to fix ?

@reneManqueros
Copy link

by changing:
readfile($filename);
to:
readfile('./images/' . $filename);

@rchrd2
Copy link

rchrd2 commented Jan 24, 2018

Very insecure, my friend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment