<?php
//i.stack.imgur.com/5aigj.png
$url = $_REQUEST['img'];
if (preg_match('@\A(?:https?:)?//i\.stack\.imgur\.com/(\w+\.(png|jpe?g|gif)([&?].*)?)\z@i', $url, $matches)) {
$mtime = gmdate('D, d M Y') . ' 00:00:01 GMT';
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])
&& (!$matches[3] || $mtime == $_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
header('HTTP/1.1 304 Not Modified');
die();
}
$clientcache = !$matches[3];
header('Last-Modified: ' . $mtime);
if (!$clientcache) {