Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Protecting Web Email Forms

Recommended Posts

i have a web form on my site which can be filled in with a customers email, name and question or comment. when the form is submitted an email is sent to an address i setup with all the info.recently i've been getting alot of spam/junk coming from the web form. for the most part, they usually come pretty close together, which makes it seem like just one spammer (at least at a time). also i'm talking like 5-10 messages at a time. i'm wondering if people have any suggestions how to protect these types of web forms from spammers.any ideas/help is appreciatedkvarnerexpress

Share this post


Link to post
Share on other sites

I was getting a similar thing from one of my forms. All the spam was coming from online gaming sites and they kept copying their keywords into all the fields. So I set up a filter on the commonly used spam words and now I don't get it any more. (This was done in ASP, but the method will be the same for PHP.)

'checks for spamDim spam, spamArrayspam = false spamArray = Array("poker", "viagra", "texas", "xanax", "holdem")for i=0 to 4	if (InStr(Request.Form("message"),spamArray(i)) > 0 ) then  spam = true	end ifnext
You put the words you want to filter out into the array, then loop through the relevant field (in my case, the message field) a few times to see if any of those words are present. If they are, spam = true and the email doesn't get sent.

Share this post


Link to post
Share on other sites

Here's a PHP version of the above script:

$spam = false;spamArray = array("poker", "viagra", "texas", "xanax", "holdem");for($x = 0; $x < count($spamArray); $x++){     if (substr_count($_POST['message'],spamArray[$x]) > 0 )     {          $spam = true;     }}if(!$spam)     mail(...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.