Quote:
Originally Posted by Web-Design-Guy
Can anyone help me out?
Ideally, rather than CAPTCHA, it will ask maths questions or similar.
Here's hoping.
|
Here's a simple script that will produce your math questions:
Make sure you have sessions enabled.
Code:
srand ((double) microtime( )*1000000);
$_SESSION['human_check'] = rand(0,999);
$question = ($_SESSION['human_check'] - 1);
$question2 = "What is the next number after the number " . $question . "?";
Add the question to your form:
Code:
<label /><?php echo $question2; ?> <input type="text" name="human_answer" size="3" maxlength="3" value="0" />
Compare the response with your $_SESSION['human_check'] variable.
Code:
if($_SESSION['human_check'] == $_POST['human_answer']) {
$g = TRUE;
} else {
$g = FALSE;
$message[] = "You failed to enter the correct number into the number field.";
}
Validate the rest of your variables and you're set.