PHP Classes

File: example_submit.php

Recommend this page to a friend!
  Classes of Chris Hepner   Friendly CAPTCHA   example_submit.php   Download  
File: example_submit.php
Role: Example script
Content type: text/plain
Description: Example Implementation (part 2)
Class: Friendly CAPTCHA
CAPTCHA validation using text with math expression
Author: By
Last change:
Date: 15 years ago
Size: 716 bytes
 

Contents

Class file image Download
<?php

require('library/FriendlyCaptcha.class.php');
require(
'library/MathCaptcha.class.php');

$testcaptcha = new mathCaptcha();

$answer = $_POST['math_captcha'];

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CAPTCHA Test - Result</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php



if($testcaptcha->checkAnswer($answer))
   
//answer is correct
   
echo "The captcha was answered correctly.";
else
   
//Answer is wrong
   
echo "The answer you supplied is incorrect, please try again.";



?>
</body>
</html>