Page 1 of 1
Anti Spam Script
Posted: Wed Mar 11, 2009 1:08 pm
by ninethousandfeet
hello,
i am trying to add a simple anti-spam script using the sum of 1+2, but it will not work properly... right now i have a column in my userTable as 'test' varchar(5) not NULL. i've also tried to make this column ENUM with set values already at '3','three'...
is it a problem with my error code? database? or am i forgetting to define the variable or something??... or none of the above
thank you!
Code: Select all
// test question
if (empty($_POST['test']) || $_POST['test'] != 3 || strtolower($_POST['test']) != 'three') {
$error[] = 'Check your math.';
}
...then this is the part where it shows up in my form
Code: Select all
<td nowrap="nowrap" align="right">Sum of 1 and 2?</td>
<td><input name="test" type="text" id="test" value="" size="32" /></td>
Re: Anti Spam Script
Posted: Wed Mar 11, 2009 1:32 pm
by kaisellgren
It is very easy to write a bot that takes the spam challenge and solves it. Why not use a CAPTCHA? Would be much better.
Re: Anti Spam Script
Posted: Wed Mar 11, 2009 1:44 pm
by ninethousandfeet
i was going to use this for starters, but i'm all ears. do you have any recommendations so i can learn how to write that script? i'm fairly new to development so i'm kind of all over the place.
thank you
Re: Anti Spam Script
Posted: Wed Mar 11, 2009 1:53 pm
by kaisellgren
ninethousandfeet wrote:i was going to use this for starters, but i'm all ears. do you have any recommendations so i can learn how to write that script? i'm fairly new to development so i'm kind of all over the place.
thank you
Writing a CAPTCHA is hard if you want it to be good. As you are a beginner, I would recommend to use something simple like
http://recaptcha.net/
Re: Anti Spam Script
Posted: Wed Mar 11, 2009 2:07 pm
by ninethousandfeet
okay, i'll definitely take a look... i would prefer to not have the CAPTCHA on my home screen since my login and new user registration are both on that page. i would much rather have the user fill out the registration form, go to a new page with the CAPTCHA verification, and then to a 'thank you' page. ... then on kind of a different subject, i would like the user to have to click a link in their email to verify the account so i can validate the emails entered into my database are legitimate.
i guess my main question is how do i pass the information from a new registration form to another page without setting it in the database. i don't want a user to press 'register' and then be able to login if they have yet to do the CAPTCHA and email verification.
Re: Anti Spam Script
Posted: Wed Mar 11, 2009 2:41 pm
by jayshields
ninethousandfeet wrote:i guess my main question is how do i pass the information from a new registration form to another page without setting it in the database.
sessions
Re: Anti Spam Script
Posted: Wed Mar 11, 2009 5:22 pm
by ninethousandfeet
do i insert the registration info into a temporary table and then pass that with a session variable to the page with CAPTCHA? i just don't see how i can avoid a user filling out the registration form, closing the following CAPTCHA page, returning to the login page, and login... having never completed the CAPTCHA verification and email verification.
my current understanding of sessions are they allow access to a page based on whether that user has logged in.
any advice is helpful, thank you!