diff --git a/index.php b/index.php index 7f149a70..7ca6ef9f 100644 --- a/index.php +++ b/index.php @@ -32,7 +32,13 @@ function trafic_limiter_canPass($ip) if (!empty($tl[$ip]) && ($tl[$ip]+10>=time())) { return false; - // FIXME: purge file of expired IPs to keep it small + } else { + unset($tl[$ip]); + } + foreach ($tl as $k => $v) { + if ($k != $ip && $v+10<=time()) { + unset($tl[$k]); + } } $tl[$ip]=time(); file_put_contents($tfilename, ""); @@ -406,4 +412,4 @@ function processPasteFetch($pasteid) $page->assign('ERRORMESSAGE',$ERRORMESSAGE); $page->assign('STATUS',$STATUS); $page->draw('page'); -?> \ No newline at end of file +?>