Fix forwarded IP comparison in login-ip plugin
The issue described in #372 is the same for the HTTP_X_FORWARDED_FOR comparison. strncasecmp returns 0 when the two strings are equal which is falsey.
This commit is contained in:
parent
9ab205776d
commit
3f38b61366
|
@ -29,7 +29,7 @@ class AdminerLoginIp {
|
||||||
}
|
}
|
||||||
if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
|
if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
|
||||||
foreach ($this->forwarded_for as $forwarded_for) {
|
foreach ($this->forwarded_for as $forwarded_for) {
|
||||||
if (strncasecmp(preg_replace('~.*, *~', '', $_SERVER["HTTP_X_FORWARDED_FOR"]), $forwarded_for, strlen($forwarded_for))) {
|
if (strncasecmp(preg_replace('~.*, *~', '', $_SERVER["HTTP_X_FORWARDED_FOR"]), $forwarded_for, strlen($forwarded_for)) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue