(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";
exit;
}
- if ($fBucketVal > CONST_ConnectionBucket_WaitLimit)
- {
- sleep(($fBucketVal - CONST_ConnectionBucket_WaitLimit)/CONST_ConnectionBucket_LeakRate);
- }
-
header('Content-type: text/html; charset=utf-8');
return $iMaxVal;
}
+ function byLastBlockTime($a, $b)
+ {
+ if ($a['lastBlockTimestamp'] == $b['lastBlockTimestamp'])
+ {
+ return 0;
+ }
+ return ($a['lastBlockTimestamp'] > $b['lastBlockTimestamp']) ? -1 : 1;
+ }
+
function getBucketBlocks()
{
$m = getBucketMemcache();
'currentlyBlocked' => $iCurrentBucketSize + (CONST_ConnectionBucket_Cost_Reverse) >= CONST_ConnectionBucket_BlockLimit,
);
}
+ uasort($aBlockedList, 'byLastBlockTime');
return $aBlockedList;
}