Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » PHPGoto page 1, 2  Next

Guestbook spam protection

 
Jump to:  
 
Mathieu Maes
PostPosted: Thu Jul 03, 2008 8:30 am    Post subject: Guestbook spam protection
       
Hello everyone,

I have created a simple guestbook for my bandsite (http://www.thefirm-
online.be). As you might expect, some spambots have jumped on it as
soon as it went online. At the moment, I've put the following measures
in place:
- Protection against XSS attacks, SQL injections, etc...
- Check the IP address - if the origin is abroad, the post is inactive
and needs approval by a moderator (me).

Currently I have to delete 25 spam posts /day which is getting a
little ridiculous. I'm looking for a much better solution.

Already found solutions (which I won't use)
- CAPTCHA - I don't want to punish every visitor for having those
spambots. it's not that safe either. I prefer not using this kind of
solution.
- Make a dynamic image (php-file outputting the image) store a
variable in the session. Problem is that images are cached by the
browser, making it usable only the first time the user visits the
website.
- Have a javascript function alter some hidden value in the form.
Haven't tried this yet...
- Found several "commercial" solutions where the form is being
encrypted. Haven't tried this yes either...


Thanks for your help
Mathew
 

 
Geoff Berrow
PostPosted: Thu Jul 03, 2008 8:30 am    Post subject: Re: Guestbook spam protection
       
Message-ID:
<4bbf3fa7-a8bd-4884-bc7e-f080dafcdc8c@t54g2000hsg.googlegroups.com> from
Mathieu Maes contained the following:

Quote:
Currently I have to delete 25 spam posts /day which is getting a
little ridiculous. I'm looking for a much better solution.

I don't allow links or URLs. I have a banned word list and so far I
haven't has to add more than three words 'http://' ' LINK' and '<'. Any
one who legitimately needs to post a link can always write
www[dot]example[dot]com, but that's no advantage to spammers who simply
want to get links published.

I've also been experimenting with an enquiry form that used to get
spammed. I've added a secret field, hidden by CSS.

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

Bots will usually either leave it out or fill it with garbage and so I
check for this like so:-

if(!isset($_POST[$secret_field])||$_POST[$secret_field]!=""){
//at the moment I'm prepending the resultant email's subject
// with [SPAM] but eventually may just silently drop it.
}

--
Regards,

Geoff Berrow
 

 
Michael Berkowski
PostPosted: Thu Jul 03, 2008 11:01 am    Post subject: Re: Guestbook spam protection
       
On Thu, 03 Jul 2008 10:19:43 +0100
Geoff Berrow <blthecat@ckdog.co.uk> wrote:

Quote:
I've also been experimenting with an enquiry form that used to get
spammed. I've added a secret field, hidden by CSS.

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

Bots will usually either leave it out or fill it with garbage and so I
check for this like so:-

if(!isset($_POST[$secret_field])||$_POST[$secret_field]!=""){
//at the moment I'm prepending the resultant email's subject
// with [SPAM] but eventually may just silently drop it.
}

In our organization, we have a number of different "contact us" forms.
Our ASP.NET developer tends to use the hidden field method you
described with success. On my PHP pages, I sometimes use the same
method, but in some cases I've added a little arithmetic captcha
something like the following. Get two random integers less than 10,
and ask the user to sum them.

<?php
// Create the session variables for the math problem
session_start();
$_SESSION['n1'] = rand(1,9);
$_SESSION['n2'] = rand(1,9);
?>
<label for='math'>
What is <?php echo $_SESSION['n1'] . " + " .$_SESSION['n2']; ?>
</label> <input id='math' type='text' name='math' />

I know CAPTCHAs were to be avoided in the original post, but this one
is so trivial. (Though it might keep out first graders). I've never
had spam on one of these forms except for the occasional manually
entered list of links once or twice a year.
--
Michael Berkowski <berk0081@NOSPAM.umn.edu>
 

 
Mathieu Maes
PostPosted: Fri Jul 04, 2008 7:47 am    Post subject: Re: Guestbook spam protection
       
On 3 jul, 15:01, Michael Berkowski <berk0...@NOSPAMumn.edu> wrote:
Quote:
On Thu, 03 Jul 2008 10:19:43 +0100

Geoff Berrow <blthe...@ckdog.co.uk> wrote:
I've also been experimenting with an enquiry form that used to get
spammed.  I've added a secret field, hidden by CSS.

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

Bots will usually either leave it out or fill it with garbage and so I
check for this like so:-

if(!isset($_POST[$secret_field])||$_POST[$secret_field]!=""){
//at the moment I'm prepending the resultant email's subject
// with [SPAM]  but eventually may just silently drop it.
}

In our organization, we have a number of different "contact us" forms.
Our ASP.NET developer tends to use the hidden field method you
described with success.  On my PHP pages, I sometimes use the same
method, but in some cases I've added a little arithmetic captcha
something like the following.  Get two random integers less than 10,
and ask the user to sum them.

?php
// Create the session variables for the math problem
session_start();
$_SESSION['n1'] = rand(1,9);
$_SESSION['n2'] = rand(1,9);
?
label for='math'
        What is  <?php echo $_SESSION['n1'] . " + " .$_SESSION['n2']; ?
/label> <input id='math' type='text' name='math' /

I know CAPTCHAs were to be avoided in the original post, but this one
is so trivial. (Though it might keep out first graders).  I've never
had spam on one of these forms except for the occasional manually
entered list of links once or twice a year.
--
Michael Berkowski <berk0...@NOSPAM.umn.edu


Thanks for all replies so far! I like the banned words list and hidden
input fields, I'll give that a try for sure!

The main goal for me personally is to avoid spam, but I don't want to
annoy the "normal" visitors with security features. I know my visitors
are very simple people, to say the least. If I show the guestbook to
my mom, she will just mock me because she needs to answer a simple sum
to sign a guestbook :-)

On that topic, I've seen more creative captcha's using images. I could
show 9 pictures from our band and ask the user to click 3 pictures
from the drummer for example. (Idea came from KittenAuth -
LINK)

Requiring users to confirm their post by email would scare some people
because they don't want to give their email.
 

 
Twayne
PostPosted: Fri Jul 04, 2008 1:02 pm    Post subject: Re: Guestbook spam protection
       
Quote:
On 3 jul, 15:01, Michael Berkowski <berk0...@NOSPAMumn.edu> wrote:
On Thu, 03 Jul 2008 10:19:43 +0100

Geoff Berrow <blthe...@ckdog.co.uk> wrote:
I've also been experimenting with an enquiry form that used to get
spammed. I've added a secret field, hidden by CSS.

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

Bots will usually either leave it out or fill it with garbage and
so I check for this like so:-

if(!isset($_POST[$secret_field])||$_POST[$secret_field]!=""){
//at the moment I'm prepending the resultant email's subject
// with [SPAM] but eventually may just silently drop it.
}

In our organization, we have a number of different "contact us"
forms. Our ASP.NET developer tends to use the hidden field method you
described with success. On my PHP pages, I sometimes use the same
method, but in some cases I've added a little arithmetic captcha
something like the following. Get two random integers less than 10,
and ask the user to sum them.

?php
// Create the session variables for the math problem
session_start();
$_SESSION['n1'] = rand(1,9);
$_SESSION['n2'] = rand(1,9);

label for='math'
What is <?php echo $_SESSION['n1'] . " + " .$_SESSION['n2']; ?
/label> <input id='math' type='text' name='math' /

I know CAPTCHAs were to be avoided in the original post, but this one
is so trivial. (Though it might keep out first graders). I've never
had spam on one of these forms except for the occasional manually
entered list of links once or twice a year.
--
Michael Berkowski <berk0...@NOSPAM.umn.edu


Thanks for all replies so far! I like the banned words list and hidden
input fields, I'll give that a try for sure!

The main goal for me personally is to avoid spam, but I don't want to
annoy the "normal" visitors with security features. I know my visitors
are very simple people, to say the least. If I show the guestbook to
my mom, she will just mock me because she needs to answer a simple sum
to sign a guestbook :-)

On that topic, I've seen more creative captcha's using images. I could
show 9 pictures from our band and ask the user to click 3 pictures
from the drummer for example. (Idea came from KittenAuth -
LINK)

Requiring users to confirm their post by email would scare some people
because they don't want to give their email.

IME the captcha scares people off too, especially neophytes or those in
a hurry if they have to squint etc. to figure out the
distorted/over-lined/hidden in colors etc. characters, especially the
visually challenged and color blind. For things like guest books you
want to make it as easy as you can bit still keep some security too.
IMO a simple expansion on your original idea might be a better
solution, only use a random-length, random number and allow the digits
to go negative (e.g. mt_rand(-99, 00)). Print them in the clear and use
those plus a related question; maybe the number of digits in the code or
something, to add a further layer to it. Or just ask for the middle 3
numbers, etc. of the code instead of the whole thing; lots of things one
could do.

HTH, just my thoughts for the moment.
 

 
Guest
PostPosted: Tue Sep 02, 2008 8:21 am    Post subject:
       
Path: news.netfront.net!zen.net.uk!dedekind.zen.co.uk!feeder.news-service.com!69.16.177.246.MISMATCH!cyclone03.ams.highwinds-media.com!news.highwinds-media.com!npeersf01.ams.highwinds-media.com!newsfe14.ams2.POSTED!7564ea0f!not-for-mail
From: illona<lona@vm.co.uk>
Newsgroups: comp.lang.php
Subject: Re: Guestbook spam protection
Message-ID: <v3gpb4hd8faeiqtf4ubtkeh96ptdglaorq@4ax.com>
References: <4bbf3fa7-a8bd-4884-bc7e-f080dafcdc8c@t54g2000hsg.googlegroups.com> <fo5p64dbje1j3sq5u2k90ds133b05beg7t@4ax.com> <20080703080143.f0cb9bc2.berk0081@NOSPAMumn.edu> <cc445e5b-d483-457d-86f2-10043379a0c5@34g2000hsh.googlegroups.com> <hYqbk.78$0V1.64@trndny01>
X-Newsreader: Forte Agent 1.8/32.553
X-No-Archive: yes
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 15
NNTP-Posting-Host: 213.48.36.2
X-Complaints-To: LINK
X-Trace: newsfe14.ams2 1220329867 213.48.36.2 (Tue, 02 Sep 2008 04:31:07 UTC)
NNTP-Posting-Date: Tue, 02 Sep 2008 04:31:07 UTC
Organization: virginmedia.com
Date: Tue, 02 Sep 2008 05:33:35 +0100
Xref: news.netfront.net comp.lang.php:149220

On Fri, 04 Jul 2008 15:02:37 GMT, "Twayne" <nobody@devnull.spamcop.net> wrote:

Quote:


There is a professional solution if captchas are bad (I agree with that too by
the way)

Take a look at LINK
Their solution isnt cheap but I can attest that once you have it you'll want to
use it everywhere (and you only buy it once to use everywhere)
Its a bit hard to get your head round at first but when the penny drops its
easy. You can protect existing or new forms in seconds. (really)
We have it on every form and forum post now. We dont have a guest book
but it should work just fine as those are just forms anyway.
 

 
Jerry Stuckle
PostPosted: Tue Sep 02, 2008 10:30 am    Post subject: Re: Guestbook spam protection
       
illona wrote:
Quote:
On Fri, 04 Jul 2008 15:02:37 GMT, "Twayne" <nobody@devnull.spamcop.net> wrote:


There is a professional solution if captchas are bad (I agree with that too by
the way)

Take a look at LINK
Their solution isnt cheap but I can attest that once you have it you'll want to
use it everywhere (and you only buy it once to use everywhere)
Its a bit hard to get your head round at first but when the penny drops its
easy. You can protect existing or new forms in seconds. (really)
We have it on every form and forum post now. We dont have a guest book
but it should work just fine as those are just forms anyway.



There is no need for your expensive package. There are much better ways
to handle CAPTCHA than an image.

For instance, I often use simple arithmetic in words, i.e. "How much is
five minus four?" or "What is the sum of three and six"? These are easy
for a person to solve, can be used with a screen reader by the visually
impaired, yet harder to parse by 'bots, especially if you vary the
wording (I typically have multiple sentences).

And BTW - CAPTCHA is not the image. CAPTCHA is a process. A CAPTCHA
image is one way to handle the process.

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

 
Twayne
PostPosted: Tue Sep 02, 2008 1:00 pm    Post subject: Re: Guestbook spam protection
       
Quote:
illona wrote:
On Fri, 04 Jul 2008 15:02:37 GMT, "Twayne"
nobody@devnull.spamcop.net> wrote: There is a professional solution
if captchas are bad (I agree with
that too by the way)

Take a look at LINK
Their solution isnt cheap but I can attest that once you have it
you'll want to use it everywhere (and you only buy it once to use
everywhere) Its a bit hard to get your head round at first but when
the penny
drops its easy. You can protect existing or new forms in seconds.
(really) We have it on every form and forum post now. We dont have a
guest
book but it should work just fine as those are just forms anyway.



There is no need for your expensive package. There are much better
ways to handle CAPTCHA than an image.

For instance, I often use simple arithmetic in words, i.e. "How much
is five minus four?" or "What is the sum of three and six"? These
are easy for a person to solve, can be used with a screen reader by
the visually impaired, yet harder to parse by 'bots, especially if
you vary the wording (I typically have multiple sentences).

Ah, I'm not the only one doing that; great. I even still generate a
random number to type in but it's fully readable and not in an image.
I've also spread the bot-test Qs into two forms, the second very easy
but hopefully unexpected by the bots and not even noticed. Counting
page views and errors seems like it'd help too, and of course force only
one email address, etc. etc..
If what I read about India's captcha business is anywhere near
accurate it just proves what I've always though about those stupid hard
to read captcha images anyway. You just have to enforce the right house
rules and get as close as you can to making it too hard to bother to use
your stuff; there's always someone easier right down the pipe if you're
lucky. I suspect making the questions random too helps a lot if someone
does sit down and manually figure out the processes; but you need a
database so it's not going to repeat too quickly. Random seems to be
the magic touch for now. And natch, keep it all working fast so there
arean't any noticeable delays over the norm or where they wouldn't be
expected.

Cheers,

Twayne

Quote:

And BTW - CAPTCHA is not the image. CAPTCHA is a process. A CAPTCHA
image is one way to handle the process.
 

Page 1 of 2 .:. Goto page 1, 2  Next

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

książka telefoniczna ubezpieczenie oc Tworzenie stron katowice Tłumacz zasiłek