Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Aiheen aloitti: Mark Thomas - syyskuu 07, 2006, 07:32:21 AP

Otsikko: Ban IP "0.0.0.0"
Kirjoitti: Mark Thomas - syyskuu 07, 2006, 07:32:21 AP
We're getting folks trying to register with an IP of 0.0.0.0, most of these seem to be bottom feeders, i.e. spammers. When I setup a ban trigger on said IP it doesn't register and I see "(No ban triggers)" under "Banned entity". I tried sever wildcard versions but all come back as "invalid IP range".

If you look at "Who's online" you might see the following;
Guest  (0.0.0.0)     08:17:47 am     Viewing the board .....

If they register and you look at "Awaiting Approval" you see no IP what so ever.

LainaaPowered by SMF 1.1 RC2 | TinyPortal v0.8.6 © Bloc

thanks
Otsikko: Re: Ban IP "0.0.0.0"
Kirjoitti: Harzem - syyskuu 07, 2006, 07:43:16 AP
A quick and dirty fix can be opening QueryString.php, finding that:


if (preg_match('~^((([1]?\d)?\d|2[0-4]\d|25[0-5])\.){3}(([1]?\d)?\d|2[0-4]\d|25[0-5])$~', $_SERVER['REMOTE_ADDR']) === 0)
$_SERVER['REMOTE_ADDR'] = '';


Adding this after it:


if($_SERVER['REMOTE_ADDR'] == '' || $_SERVER['REMOTE_ADDR'] == '0.0.0.0')
fatal_error('Invalid IP address.',true);


So they will get a fatal error.

These errors are also logged in your error log, so you can see whether it is working or not.
Otsikko: Re: Ban IP "0.0.0.0"
Kirjoitti: Mark Thomas - syyskuu 07, 2006, 07:48:45 AP
Thanks HarzeM.
Otsikko: Re: Ban IP "0.0.0.0"
Kirjoitti: Skipdawg - syyskuu 07, 2006, 12:30:11 IP
Very good!  ;D

Awesome question and answer  ;)