Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Chris Hepner  >  Friendly CAPTCHA  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example implementation
Class: Friendly CAPTCHA
CAPTCHA validation using text with math expression
Author: By
Last change:
Date: 5 years ago
Size: 1,045 bytes
 

Contents

Class file image Download
<?php

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

$testcaptcha = new mathCaptcha();
$testcaptcha->generateProblem();

?>
<!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</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php 

//Generate hidden CSS
$testcaptcha->hiddenCss(); 

?>
</head>
<body>

<form action="example_submit.php" method="post">

    <fieldset id="contactinfo">
    <legend>Verify you are human</legend>

    <label for="math_captcha"><?php $testcaptcha->printProblem(); ?></label>
    <input name="math_captcha" id="math_captcha" type="text" class="textinput" />
    
    </fieldset>
    
    <div>
    <input name="submit" value="Submit" type="submit" />
    </div>
    
<?php

//Generate optional Javascript for improved accessibility
$testcaptcha->hiddenJavascript();

?>
    
</form>

</body>
</html>