Author Topic: Preventing Spam on Forms  (Read 2087 times)

jennifer

  • Posts: 14
    • View Profile
Preventing Spam on Forms
« on: December 07, 2007, 12:15:24 pm »
I've been trying to integrate this http://duggmirror.com/programming/Preventing_SPAM_without_using_a_CAPTCHA/
on my listmail form to prevent spam, but I can't get it to work.

I don't have a lot of experience with code, so I wonder if I'm missing something. Has anyone successfully used this code with a listmail form and, if so, how'd you do it?

Thanks!

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Preventing Spam on Forms
« Reply #1 on: December 07, 2007, 07:52:22 pm »
Hello,

While the post is a bit confusing it appears the trick is to populate a variable with JavaScript.  Indeed, most bots will not be running JavaScript.

Applying it to ListMail, we could set the "list" variable or the email variable in the background, or we could possibly simply change the submit button to a standard button that submits the form with JS.

Example 1: Set email var in the background.  If the hidden var is not set ListMail will reject the signup.
Code: [Select]
<form method=post action=/mail/signup.php onSubmit="document.getElementById('email').value = document.getElementById('email2').value;">
<input type=hidden name=list value=1>
<input type=hidden id=email name=email value="">
Email <input type=text id=email2 name=email2><br>
<input type=submit value="Subscribe!">
</form>

Example 2: No submit button - this solution may prove useless as bots can probably detect the <form>...
Code: [Select]
<form id=signupForm method=post action=/mail/signup.php>
<input type=hidden name=list value=1>
Email <input type=text name=email><br>
<input type=button value="Subscribe!" onclick="document.getElementById('signupForm').submit();">
</form>

I hope that helps!
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting