]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/init-website.php
sort output of blocked list by block timestamp
[nominatim.git] / lib / init-website.php
index 40e4713e21c1c6261fd12910d239c880d522a402..8f04d97d9029832af60cb84e254996726b2b1511 100644 (file)
                        (defined('CONST_ConnectionBucket_PageType')?constant('CONST_ConnectionBucket_Cost_'.CONST_ConnectionBucket_PageType):1) + user_busy_cost(),
                        CONST_ConnectionBucket_LeakRate, CONST_ConnectionBucket_BlockLimit);
 
+       if ($fBucketVal > CONST_ConnectionBucket_WaitLimit && $fBucketVal < CONST_ConnectionBucket_BlockLimit)
+       {
+               sleep(($fBucketVal - CONST_ConnectionBucket_WaitLimit)/CONST_ConnectionBucket_LeakRate);
+               $fBucketVal = doBucket($aBucketKeys, 0, 0, CONST_ConnectionBucket_BlockLimit);
+       }
+
        if (strpos(CONST_BlockedIPs, ','.$_SERVER["REMOTE_ADDR"].',') !== false || $fBucketVal >= CONST_ConnectionBucket_BlockLimit)
        {
                echo "Your IP has been blocked. \n";
@@ -25,9 +31,4 @@
                exit;
        }
 
-       if ($fBucketVal > CONST_ConnectionBucket_WaitLimit)
-       {
-               sleep(($fBucketVal - CONST_ConnectionBucket_WaitLimit)/CONST_ConnectionBucket_LeakRate);
-       }
-
        header('Content-type: text/html; charset=utf-8');