Preventing spammers from using mail form

This is a discussion on Preventing spammers from using mail form within the PHP Language forums, part of the PHP Programming Forums category; I created a small website for a friend. On this website he has a contact page where people can send ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-21-2008
MikeB
 
Posts: n/a
Default Preventing spammers from using mail form

I created a small website for a friend. On this website he has a
contact page where people can send him email. When I wrote this page I
checked some tutorial pages and they warned about certain precautions
to take to avoid spammers using the mail form to spam multiple
people.

I believe I did most of that, such as making sure that the header
fields does not include multiple addresses, etc.

Now it does seem some spammer has discovered this website and he is
spamming my friend. 20 emails today.

So I figure I need to add more things to the script to stop him. One
obvious thought that came to my mind is to use a captcha. Will that be
the way to go or are there other things that I need to do?

The website is (owen pool care [dot] com), (remove all spaces)if
anyone is interested in looking at the sitet.

I guess I can also post it somewhere, but I don't know exactly where.

Thanks for any advice.
Reply With Quote
  #2 (permalink)  
Old 07-21-2008
John W Kennedy
 
Posts: n/a
Default Re: Preventing spammers from using mail form

MikeB wrote:
> I created a small website for a friend. On this website he has a
> contact page where people can send him email. When I wrote this page I
> checked some tutorial pages and they warned about certain precautions
> to take to avoid spammers using the mail form to spam multiple
> people.
>
> I believe I did most of that, such as making sure that the header
> fields does not include multiple addresses, etc.
>
> Now it does seem some spammer has discovered this website and he is
> spamming my friend. 20 emails today.
>
> So I figure I need to add more things to the script to stop him. One
> obvious thought that came to my mind is to use a captcha. Will that be
> the way to go or are there other things that I need to do?
>
> The website is (owen pool care [dot] com), (remove all spaces)if
> anyone is interested in looking at the sitet.
>
> I guess I can also post it somewhere, but I don't know exactly where.
>
> Thanks for any advice.


One simple trick that has worked well for me is to build the Submit
button in JavaScript (loaded from a *.js file) instead of HTML. It
doesn't stop determined humans, so you occasionally get advertising from
Chinese firms that use slave labor to do their spamming, but it stops
robots cold. Naturally you need a <NOSCRIPT> warning about this.

Other than that, the usual method is to use a CAPTCHA.

--
John W. Kennedy
"Compact is becoming contract,
Man only earns and pays."
-- Charles Williams. "Bors to Elayne: On the King's Coins"
Reply With Quote
  #3 (permalink)  
Old 07-21-2008
Dale
 
Posts: n/a
Default Re: Preventing spammers from using mail form


"John W Kennedy" <jwkenne@attglobal.net> wrote in message
news:4883d66c$0$20936$607ed4bc@cv.net...
> MikeB wrote:
>> I created a small website for a friend. On this website he has a
>> contact page where people can send him email. When I wrote this page I
>> checked some tutorial pages and they warned about certain precautions
>> to take to avoid spammers using the mail form to spam multiple
>> people.
>>
>> I believe I did most of that, such as making sure that the header
>> fields does not include multiple addresses, etc.
>>
>> Now it does seem some spammer has discovered this website and he is
>> spamming my friend. 20 emails today.
>>
>> So I figure I need to add more things to the script to stop him. One
>> obvious thought that came to my mind is to use a captcha. Will that be
>> the way to go or are there other things that I need to do?
>>
>> The website is (owen pool care [dot] com), (remove all spaces)if
>> anyone is interested in looking at the sitet.
>>
>> I guess I can also post it somewhere, but I don't know exactly where.
>>
>> Thanks for any advice.

>
> One simple trick that has worked well for me is to build the Submit button
> in JavaScript (loaded from a *.js file) instead of HTML. It doesn't stop
> determined humans, so you occasionally get advertising from Chinese firms
> that use slave labor to do their spamming, but it stops robots cold.
> Naturally you need a <NOSCRIPT> warning about this.
>
> Other than that, the usual method is to use a CAPTCHA.


good point, jon. you've made it impossible to for some people to submit now
though. js-disabled browser, i mean. yes, there are still some who don't
allow js. :)

captcha stuff is good. don't forget the parsing we still need to do to
insure no one is putting in other directives - other than to whom (usually a
single individual) the email is intended to be sent. for this op, parsing
and captcha should take care of the problem. there should be no 'to' for the
user to fill out, so, the body (probably textarea) of the email is all there
is to parse.

cheers


Reply With Quote
  #4 (permalink)  
Old 07-21-2008
Geoff Berrow
 
Posts: n/a
Default Re: Preventing spammers from using mail form

Message-ID:
<edcd4a73-d3b9-4e52-b186-e891b95a3a22@w7g2000hsa.googlegroups.com> from
MikeB contained the following:

>So I figure I need to add more things to the script to stop him. One
>obvious thought that came to my mind is to use a captcha. Will that be
>the way to go or are there other things that I need to do?


Personally I hate captchas and I think they are over the top for a
simple enquiry form like this. I like captchas when they are there for
/my/ security but this one isn't, it's for your client's benefit alone.
Besides accessibility issues, they are just another obstacle for
potential customers - never a good idea. So I'd look for other ways
first and use CAPTCHA as a last, rather than first resort.

One of my client's forms was being spammed by a bot that filled all
fields with garbage. One simple way to stop this is to have an extra
field, hidden by CSS

<label for='secret_field' style='display:none'>Please leave blank <input
name='secret_field'id='secret_field'></label>

The bot will either fill the field with garbage or omit it entirely,
both easily detectable.

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Reply With Quote
  #5 (permalink)  
Old 07-21-2008
Voodoo Jai
 
Posts: n/a
Default Re: Preventing spammers from using mail form

On Jul 21, 12:43*am, MikeB <MPBr...@gmail.com> wrote:
> I created a small website for a friend. On this website he has a
> contact page where people can send him email. When I wrote this page I
> checked some tutorial pages and they warned about certain precautions
> to take to avoid spammers using the mail form to spam multiple
> people.
>
> I believe I did most of that, such as making sure that the header
> fields does not include multiple addresses, etc.
>
> Now it does seem some spammer has discovered this website and he is
> spamming my friend. 20 emails today.
>
> So I figure I need to add more things to the script to stop him. One
> obvious thought that came to my mind is to use a captcha. Will that be
> the way to go or are there other things that I need to do?
>
> The website is (owen pool care [dot] com), (remove all spaces)if
> anyone is interested in looking at the sitet.
>
> I guess I can also post it somewhere, but I don't know exactly where.
>
> Thanks for any advice.


How about reporting the Email sender for spamming, NOT SURE but I
think you take the domain name and send an email to the ISP something
like this "abuse@isp-domain-name.com" I may be wrong but someone else
will be able add more. Or just google report spammers for more info.

VoodooJai
Reply With Quote
  #6 (permalink)  
Old 07-21-2008
Jeff
 
Posts: n/a
Default Re: Preventing spammers from using mail form

Geoff Berrow wrote:
> Message-ID:
> <edcd4a73-d3b9-4e52-b186-e891b95a3a22@w7g2000hsa.googlegroups.com> from
> MikeB contained the following:
>
>> So I figure I need to add more things to the script to stop him. One
>> obvious thought that came to my mind is to use a captcha. Will that be
>> the way to go or are there other things that I need to do?

>
> Personally I hate captchas and I think they are over the top for a
> simple enquiry form like this. I like captchas when they are there for
> /my/ security but this one isn't, it's for your client's benefit alone.
> Besides accessibility issues, they are just another obstacle for
> potential customers - never a good idea. So I'd look for other ways
> first and use CAPTCHA as a last, rather than first resort.
>
> One of my client's forms was being spammed by a bot that filled all
> fields with garbage. One simple way to stop this is to have an extra
> field, hidden by CSS
>
> <label for='secret_field' style='display:none'>Please leave blank <input
> name='secret_field'id='secret_field'></label>


I like that. I assume that you actually have some value in the
"secret_field" or you'd never know it was omitted. I know that's the
case in perl, can you tell a blank posted field from an omitted field in
php?

Jeff
>
> The bot will either fill the field with garbage or omit it entirely,
> both easily detectable.
>

Reply With Quote
  #7 (permalink)  
Old 07-21-2008
Michael Fesser
 
Posts: n/a
Default Re: Preventing spammers from using mail form

..oO(Jeff)

>Geoff Berrow wrote:
>
>> One of my client's forms was being spammed by a bot that filled all
>> fields with garbage. One simple way to stop this is to have an extra
>> field, hidden by CSS
>>
>> <label for='secret_field' style='display:none'>Please leave blank <input
>> name='secret_field'id='secret_field'></label>

>
> I like that.


Many refer to it as "honeypot".

>I assume that you actually have some value in the
>"secret_field" or you'd never know it was omitted. I know that's the
>case in perl, can you tell a blank posted field from an omitted field in
>php?


Yes, empty input fields are considered "successful controls" and
submitted. It doesn't matter which language you use on the server.

Micha
Reply With Quote
  #8 (permalink)  
Old 07-21-2008
Jerry Stuckle
 
Posts: n/a
Default Re: Preventing spammers from using mail form

Voodoo Jai wrote:
> On Jul 21, 12:43 am, MikeB <MPBr...@gmail.com> wrote:
>> I created a small website for a friend. On this website he has a
>> contact page where people can send him email. When I wrote this page I
>> checked some tutorial pages and they warned about certain precautions
>> to take to avoid spammers using the mail form to spam multiple
>> people.
>>
>> I believe I did most of that, such as making sure that the header
>> fields does not include multiple addresses, etc.
>>
>> Now it does seem some spammer has discovered this website and he is
>> spamming my friend. 20 emails today.
>>
>> So I figure I need to add more things to the script to stop him. One
>> obvious thought that came to my mind is to use a captcha. Will that be
>> the way to go or are there other things that I need to do?
>>
>> The website is (owen pool care [dot] com), (remove all spaces)if
>> anyone is interested in looking at the sitet.
>>
>> I guess I can also post it somewhere, but I don't know exactly where.
>>
>> Thanks for any advice.

>
> How about reporting the Email sender for spamming, NOT SURE but I
> think you take the domain name and send an email to the ISP something
> like this "abuse@isp-domain-name.com" I may be wrong but someone else
> will be able add more. Or just google report spammers for more info.
>
> VoodooJai
>


How do you know who the ISP is? Spammers often use proxies, for
instance, so you don't know their original IP.

And even if you do, many ISP's don't care their users are spamming and
will do nothing about it. Only better ones will take any action, and
that will almost always just be a "don't do this again" to the spammer.

It's not like hosting companies who will kill a spammer's account.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #9 (permalink)  
Old 07-21-2008
Geoff Berrow
 
Posts: n/a
Default Re: Preventing spammers from using mail form

Message-ID: <AZKdnfsO15KtxhnVnZ2dnUVZ_hGdnZ2d@earthlink.com> from Jeff
contained the following:

> I like that. I assume that you actually have some value in the
>"secret_field" or you'd never know it was omitted. I know that's the
>case in perl, can you tell a blank posted field from an omitted field in
>php?


if(!isset($_POST['secret_field'])||$_POST['secret_field']!=""){
//mail is spam
}
else{
//send mail
}
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk
Reply With Quote
  #10 (permalink)  
Old 07-21-2008
MikeB
 
Posts: n/a
Default Re: Preventing spammers from using mail form

On Jul 21, 1:55 am, Geoff Berrow <blthe...@ckdog.co.uk> wrote:
> Message-ID:
> <edcd4a73-d3b9-4e52-b186-e891b95a3...@w7g2000hsa.googlegroups.com> from
> MikeB contained the following:
>
> >So I figure I need to add more things to the script to stop him. One
> >obvious thought that came to my mind is to use a captcha. Will that be
> >the way to go or are there other things that I need to do?

>
> Personally I hate captchas and I think they are over the top for a
> simple enquiry form like this. I like captchas when they are there for
> /my/ security but this one isn't, it's for your client's benefit alone.
> Besides accessibility issues, they are just another obstacle for
> potential customers - never a good idea. So I'd look for other ways
> first and use CAPTCHA as a last, rather than first resort.
>
> One of my client's forms was being spammed by a bot that filled all
> fields with garbage. One simple way to stop this is to have an extra
> field, hidden by CSS
>
> <label for='secret_field' style='display:none'>Please leave blank <input
> name='secret_field'id='secret_field'></label>
>
> The bot will either fill the field with garbage or omit it entirely,
> both easily detectable.
>
> --
> Geoff Berrow 0110001001101100010000000110
> 001101101011011001000110111101100111001011
> 100110001101101111001011100111010101101011http://slipperyhill.co.uk


This is a nice idea. I'll look into it. For now, last night I
implemented a captcha and it stopped the spam. That is a great help.

Thanks for all the advice.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:25 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0