<?php require "cache.php"; require "misc.class.php"; $Cache = new CACHE(); if (($lasthpm = $Cache->get_value('ptpimg_hpm_last')) === false) { $lasthpm = $Cache->get_value('ptpimg_hpm'); $Cache->cache_value('ptpimg_hpm_last', $lasthpm, 60); $Cache->delete_value('ptpimg_hpm'); } if (($hpm = $Cache->get_value('ptpimg_hpm')) === false) { $hpm = 1; $Cache->cache_value('ptpimg_hpm', $hpm, 0); } else { $Cache->increment('ptpimg_hpm'); } echo "Average hits in the last minute: {$lasthpm}"; echo "<br /><br />"; echo $Cache->get_value('ptpimg_hpm_last'); echo "<br />"; echo $Cache->get_value('ptpimg_hpm');
// last values $lasthpm = $Cache->get_value('ptpimg_hpm'); $lastbw = $Cache->get_value('ptpimg_bw'); $Cache->cache_value('ptpimg_hpm_last', $lasthpm, 60); $Cache->cache_value('ptpimg_bw_last', $lastbw, 60); $Cache->delete_value('ptpimg_hpm'); $Cache->delete_value('ptpimg_bw'); if ($lasthpm > 0 && $lastbw > 0) { $DB->query("INSERT into records (hits,bandwidth) value(%d, %d)", $lasthpm, $lastbw); } } if (($hpm = $Cache->get_value('ptpimg_hpm')) === false) { $hpm = 1; $Cache->cache_value('ptpimg_hpm', $hpm, 0); } else { $Cache->increment('ptpimg_hpm'); } if (($bwpm = $Cache->get_value('ptpimg_bw')) === false) { $bw = $Size; $Cache->cache_value('ptpimg_bw', $bw, 0); } else { $Cache->increment('ptpimg_bw', $Size); } header("Content-length: {$Size}"); $Contents = file_get_contents("raw/{$code}"); echo $Contents; //$DB->query("INSERT INTO access(Code,Browser,Referer,IP) VALUES('%s', '%s', '%s', %d)", $code, $_SERVER['HTTP_USER_AGENT'], $_SERVER['HTTP_REFERER'], ip2long($_SERVER['REMOTE_ADDR'])); die; // safe exit } if (isset($_GET['type']) && $_GET['type'] == "retrieve") {