问题
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:
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.
回答2:
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();
}
回答3:
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).
来源:https://stackoverflow.com/questions/1686772/looking-for-a-very-simple-spam-prevention-class-function-for-asp-classic