connect(); require('./cms/include/Image.class.php'); $image=new Image($_GET[src]); /* check cache */ $tsstring = gmdate('D, d M Y H:i:s', $image->lastmodified()) . ' GMT'; $if_modified_since = $HTTP_IF_MODIFIED_SINCE; //echo $if_modified_since."\n".$tsstring; if (trim($if_modified_since) == trim($tsstring)) { /* The UA has the exact same page we have. */ header("HTTP/1.1 304 Not Modified"); exit; } header("Content-type: ".$image->gettype()); header("Cache-control: max-age=31536000"); header("Expires: ".gmdate("D, d M Y H:i:s",time()+31536000)." GMT"); header("Content-disposition: filename=".$image->getname()); //header("Content-Length: ".$image->getlength()); header("Last-Modified: ".gmdate("D, d M Y H:i:s",$image->lastmodified())." GMT"); echo $image->get_content(); } else { $file='images/nohotlinking.gif'; $fp=fopen($file,'rb'); $content=fread($fp,filesize($file)); header("Content-type: image/gif"); header("Cache-control: no-cache"); header("Pragma: no-cache"); header("Content-disposition: filename=nohotlinking.gif"); header("Content-Length: ".strlen($content)); echo $content; } } ?>