0) { $row = SQL_FetchAssoc($rez); $knownimgs[$_REQUEST['url']] = $row['hash'].'.'.ImageMimeToExt($row['mime']); MMC_Set($lbl, $knownimgs); } SQL_FreeResult($rez); } $_REQUEST['url'] = $knownimgs[$_REQUEST['url']]; //header('X-pJJ-ImgMem: '.memory_get_usage().'/'.count($knownimgs)); MMC_Unlock($lbl); if (!empty($_REQUEST['url'])) { header('HTTP/1.1 301 Moved Permanently'); header('Location: http://i.pjj.cc/'.$_REQUEST['url']); die(); } } $_REQUEST['url'] = strtolower($_REQUEST['url']{0}.'/'.$_REQUEST['url']); } if (file_exists($_REQUEST['url'])) { //$etag = preg_replace('.*([a-f0-9]{32}).*', '\1', $_REQUEST['url']); $etag = substr($_REQUEST['url'], -36, 32); //header('X-pJJ-Filename: '.$_REQUEST['url']); header('ETag: "'.$etag.'"'); if ($_SERVER['HTTP_IF_MODIFIED_SINCE']) { header('HTTP/1.1 304 Not Modified'); die(); } $image = getimagesize($_REQUEST['url']); $fz = fopen($_REQUEST['url'], 'rb'); if ($image && $fz) { header('Content-Type: '.$image['mime']); header('Content-Length: '.filesize($_REQUEST['url'])); header('Date: '.gmdate('D, d M Y H:i:s').' GMT'); header('Last-Modified: Sat, 01 Jan 2000 11:59:59 GMT'); //header('Expires: Wed, 01 Jan 2020 12:00:00 GMT'); header('Accept-Ranges: bytes'); header('Connection: close'); if ($_SERVER['REQUEST_METHOD'] != 'HEAD') { fpassthru($fz); } fclose($fz); flush(); ignore_user_abort(true); ob_start(); require_once('../../config.php'); require_once('../../poolsql.php'); SQL_EmptyQuery("UPDATE {$GLOBALS['sql_prefix']}images SET lasthit=now() WHERE hash='{$etag}'", __FILE__.' : '.__LINE__.' : '.__FUNCTION__); //header('X-pJJ-Debug: '.ob_get_contents().' : '.serialize($GLOBALS['sql_cur'])); ob_end_clean(); die(); } } header('HTTP/1.1 404 Image Does Not Exist'); header('Location: http://gfx.projectjj.com/null.gif'); ?>