View Full Version : Stopping Bots from submitting to my Guestbook.
RickJ
Jul 25, 2006, 07:13 AM
I've got a guestbook entry page that is slammed by bots.
I know there are apps to install like this (http://www.notonebit.com/projects/killbot/), but I prefer something simpler.
I tried form validation with Dreamweaver on this test page (http://www.catholicrecordsociety.org/guestbookentryantibot.html)but it does not work. I've got validation set for the "verification" field to be a number between 12325 & 12327 but it does not work. If you enter the wrong number, you DO get an error message, but the info still comes to me via email.
What I'd REALLY like is the slick trick at the bottom of this page:
http://www.franklinaa.com/faa_contact-form.asp
Any suggestions for a very simple validation trick to stop the bots?
Thanks!
LTheobald
Jul 25, 2006, 07:37 AM
That's very easy to do Rick. What you would need is a database containing a table called something like QandA. This table would have 3 rows - an id, a question and a correct answer. On your form you would randomly select a question from the table and display it on the page. When you submit the form you also submit the ID of the question asked. The form submits to a page where the answer is checked to see if it matches what the user posted. If it doesn't, throw back an error message. If it does, then send the email.
I'll write you up an example in PHP later so that you can see what I mean.
Alternatively, there are tricks like .htaccess modifications.
RickJ
Jul 25, 2006, 07:51 AM
Thanks, LT. Keep in mind, though, I'm an old dog that is pretty dumb about learning new tricks.
You say "database" and I cower in the corner.
Whatever "trick" is the simplest for a newb will be best for me :D
LTheobald
Jul 25, 2006, 03:37 PM
OK Rick, here's the code we need. I'll step through using it with you tomorrow but now it's time for bed! It's also not tested that well so there might be mistakes!
Example PHP code to test:
<?php include("qanda.inc"); ?>
<html>
<head>
<title>ABC</title>
</head>
<body>
Hello
<?php
$qanda = new QandA();
echo $qanda->getQuestion() ."<br/>";
echo $qanda->getQuestionId() ."<br/>";
?>
</body>
</html>
RickJ
Jul 26, 2006, 03:27 AM
I must confess my stupidity. That's all french to me. I have no php experience whatsoever.
This being the case, do you think I'm better off using something like this (http://www.notonebit.com/projects/killbot/), then?
LTheobald
Jul 26, 2006, 03:51 AM
Well even with that, you will still need to write some PHP code into your web page (although not much). The internet scripts will be better than what I wrote as they would have been written up over days/weeks and not within 30 minutes before I went to bed last night :P
I'm taking my lunch break in a mo so in about 30 minutes I'll write up the instructions and then you can decide if it's easy enough to do or not.
RickJ
Jul 26, 2006, 03:55 AM
You are too kind, LT, to humor a complete boob. I will be happy to play with it a bit to see if I can figure it out.
Knowing what I want to do; do you think the php angle is the easiest/simplest?
LTheobald
Jul 26, 2006, 04:51 AM
I wouldn't say it's the easiest but it will be the most powerful. Quick question before I while I write the instructions - do you have access to anything on your web space like cPanel or phpMyAdmin?
RickJ
Jul 26, 2006, 05:01 AM
Yes. My host is using cPanel X v2.5.0 (with a variety of scripts installable via Fantastico, but I don't see anything on the list that's designed for this use).
I've got mySQL, but the most I've ever done with that is name a new database then install something to it... without a clue as to how any of it all works... :o
LTheobald
Jul 26, 2006, 08:34 AM
Well my host also has cPanel so I can just do some screenshots showing you exactly what to do. Will get round to this later tonight :)