return false;
}
- if (strpos($PATH_INFO, "..")) { // check for funny business
+ if (strpos($PATH_INFO, "..")) { // check for parent URLs
+ return false;
+ }
+ if (strpos($PATH_INFO, "|")) { // check for pipes
+ return false;
+ }
+ if (strpos($PATH_INFO, "`")) { // check for backquotes
return false;
}
$lastmodified = filemtime($pathname);
- header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
- header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
- header("Cache-control: max_age = $lifetime"); // a day
- header("Pragma: ");
- header("Content-disposition: inline; filename=$image");
- header("Content-length: ".filesize($pathname));
- header("Content-type: image/jpeg");
- readfile("$pathname");
+ if (file_exists($pathname)) {
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
+ header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
+ header("Cache-control: max_age = $lifetime"); // a day
+ header("Pragma: ");
+ header("Content-disposition: inline; filename=$image");
+ header("Content-length: ".filesize($pathname));
+ header("Content-type: image/jpeg");
+ readfile("$pathname");
+ }
exit;
?>