|
@@ -12,14 +12,14 @@ class bot_protection{
|
|
|
$source = $_SERVER["REMOTE_ADDR"];
|
|
$source = $_SERVER["REMOTE_ADDR"];
|
|
|
}else{
|
|
}else{
|
|
|
|
|
|
|
|
- $source = $_SERVER[explode(";", strtoupper(str_replace("-", "_", config::IP_SOURCE)))[0]];
|
|
|
|
|
|
|
+ $source = $_SERVER["HTTP_" . explode(";", strtoupper(str_replace("-", "_", config::RATELIMIT_IP_SOURCE)))[0]];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// check if its not a local IP. Probably local tor bridge, dont ratelimit
|
|
// check if its not a local IP. Probably local tor bridge, dont ratelimit
|
|
|
if(
|
|
if(
|
|
|
filter_var(
|
|
filter_var(
|
|
|
- $source,
|
|
|
|
|
- FILTER_VALIDATE_IP,
|
|
|
|
|
|
|
+ $source,
|
|
|
|
|
+ FILTER_VALIDATE_IP,
|
|
|
FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE
|
|
FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE
|
|
|
) !== false
|
|
) !== false
|
|
|
){
|
|
){
|
|
@@ -27,7 +27,7 @@ class bot_protection{
|
|
|
$source = "r." . $source;
|
|
$source = "r." . $source;
|
|
|
|
|
|
|
|
// counter
|
|
// counter
|
|
|
- // resets on every req
|
|
|
|
|
|
|
+ // resets on every req
|
|
|
$counter = apcu_fetch($source);
|
|
$counter = apcu_fetch($source);
|
|
|
$counter = (int)$counter + 1;
|
|
$counter = (int)$counter + 1;
|
|
|
|
|
|