skip SFS check for obviously private IP addresses

This commit is contained in:
marius 2017-07-26 16:14:32 +02:00
parent 20d07be2b8
commit dfecb88bd3
1 changed files with 7 additions and 2 deletions

View File

@ -93,8 +93,13 @@ For further information and assistance with ".PROJECT.", visit
//
function is_valid_email_addr($addr) {
if (defined("USE_STOPFORUMSPAM") && USE_STOPFORUMSPAM && array_key_exists('REMOTE_ADDR', $_SERVER)) {
$ip_addr = $_SERVER['REMOTE_ADDR'];
$x = @file_get_contents("https://www.stopforumspam.com/api?ip=".$ip_addr."&email=".$addr);
$ip = $_SERVER['REMOTE_ADDR'];
// For obviously private IPs check just the email against SFS, otherwise check both IP and email
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
$x = @file_get_contents("https://www.stopforumspam.com/api?ip=".$ip."&email=".$addr);
} else {
$x = @file_get_contents("https://www.stopforumspam.com/api?email=".$addr);
}
if (substr_count($x, '<appears>yes</appears>')) {
return false;
}