Forum Moderators: phranque
Does anyone have any experience blocking abusive bots on godaddy?
I find it surprising you can't create an .htaccess file on your domain with godaddy, that would be easier to maintain. If not, a perly method,
@banned = (
'123\.456\..*',
'789\..*',
);
foreach $b (@banned) {
if ($ENV{'REMOTE_ADDR'} =~/$b/) { &exit_banned; last; }
}
Where &exit_banned prints a denied message and immediately exits the program without satisfaction. In the list, 789\..* bans all IPs in the class starting with 789, if it's specific single IP's use the whole address:
'123\.456\.789\.123'
Will the code you posted work if I add it to an .htaccess file?
No. It's Perl code. The idea is, you add this to whatever program you use to process your form data. IF it's written in Perl. Of course, if it's written in PHP, you'd have to do something similar in PHP, etc.
The key thing here is that the IP address of the visitor is available in an environment variable. So, you can test it in the program that processes your forms, and refuse to process the form for certain IP addresses.