views:

76

answers:

3

I am looking for a very simple solution to prevent (or reduce) form spamming. I've got quite a few ASP classic applications that contain contact us/miscellaneous forms here and there that generate emails. Few of them have been caught by spam bots and are being abused. I need very simple solution(s) to reduce spam if not eliminate it. Audio/Visual CAPTCHAs are out of question as visitors will end up spending more time solving captchas than to use the form itself. Session/timestamp/javascript hidden variables techniques are acceptable provided someone has used them and is reasonably satisfied with the results. A class or utility function would be preferred. Thanks.

+1  A: 

If you want very simple spam checker then you can try following... add hidden input on your form. in your submit onclick event assign value to the hidden. document.getElementByName('hdn').value = "1";

then you need to check on your action form if hdn is equal to "1". It will save you from a lot of bots that couldn't run javascript (a lot of them couldn't).

Danil
Yeah, but you'll lose people that block JavaScript. Depending on your traffic levels and audience that can be problematic.
acrosman
@acrosman: although technically correct, it's hard to believe that regular people succeed at using the web with javaScript turned off. It can be the case in some phones, but still...
Eduardo Molteni
+2  A: 

The simplest one that have worked 100% for me (for custom/low traffic sites, of course) is changing

<INPUT type="submit" value="send">

for

<INPUT onclick="OnSendClicked()" type="button" value="send">

and then

function OnSendClicked() {
 var f = document.frm;
 f.Send.value = "Yes"; //Optional, if you want to check for Yes on the server
 f.submit();
 }
Eduardo Molteni
+5  A: 

I'd suggest using a honeypot field. This has been discussed before on StackOverflow, and many people have success with it. I haven't seen anyone write up the details for doing it with ASP classic, but it shouldn't be significantly harder than it is with PHP.

Basically you put up the field, and hide it with CSS or JS, if it's not empty you'll looking at a bot. It is defeatable, but most every system is eventually.

acrosman
+1. This method provides a good fallback strategy.
Eduardo Molteni
I've implemented (i) a honeypot field (ii) a javascript based check as described below (iii) a session check to see if the user has posted directly without opening the form
Salman A