By Mark_J on
Hi,
I am on Drupal 6.x and I am using AntiSpam.
However what I want to do is prevent users (bots) from registering when an email address coming from a provider hosted in a particular country is used. For example "example.com".
So anyone entering "fdE764bX @ example.com" or "xb743bxjm @ example.com" should not be allowed to register at all. It shouldn't even go to the blocked section. The access should simply be denied. I am so sick of receiving these bogus registrations, I am ready to block entire service providers.
Is this possible? If not, perhaps I should seek my solution in the .htaccess file?
Comments
You can do it using form
You can do it using form alter and change validation function of user module
i.e function user_validate_name($name)
Here you can simply add your condition, that's it.
Thank you, thank you! You
Thank you, thank you! You pointed me at the right direction. The function I need to modify is actually function user_validate_mail($mail) since I want to check for an email address and I can use the substr function to chop the string and return a value! I am about to try it out :)
It works! Thank you! I will
It works! Thank you! I will ban so many spammer hosts and will save a copy of my mod so when I upgrade Drupal I can restore things.
Here is a sample code:
1234567 is just an example here as I don't want to bad-mouth/offend anyone.
Thank you! :)
_
Why not just do this at admin/user/rules? what am i missing?
Ok I just saw that but looks
Ok I just saw that but looks like a tedious job!
I actually did something much more efficient!! :)
First, I got this file: http://compuweb.com/url-domain-bl.txt
Then, I wrote a simple function in user.modules. The idea is to compare each line in the the spamlist file against the entered email address and check whether the current line in the file is contained within the user entered email address string.
Then in user_validate_mail, at the very bottom I added:
So my entire function looks like this:
Ok, I know it's a bad practice to mess around with the Drupal modules but at the moment, I don't know how to turn this into a module or an override (haven't RTFMed/Googled enough (links are more than welcome :D) ).
_
ah... that's different than what I thought you were asking for. You can easily add rules with masks so I don't find it particularly tedious, but there's also http://drupal.org/project/httpbl that works with the honeypot bl which is constantly kept updated.
That look like a good module.
That looks like a good module. Thanks for that. I'd still keep my spamlist though. In the last 4 hours I have only received one registration but I can't work out if's real or not. The domain is very real and legit but the user name is dodgy. I approved it and will monitor its activities and if it disappoints, I will just add it to my spam list at the end of the file.