PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Francisco del Aguila   SGCaptcha   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Sample use of sgcaptcha.php
Class: SGCaptcha
CAPTCHA validation using geometric shapes
Author: By
Last change: Upload
Date: 9 years ago
Size: 1,562 bytes


Class file image Download
// Example for the PHP simple geometric captcha
$sent = (isset($_SESSION['captcha'])) ? TRUE : FALSE;
    if (
$sent) {
$value = stripslashes(strip_tags(trim($_POST['value'])));
$captchaOk = ($value == $_SESSION['captcha']) ? TRUE : FALSE;
<!DOCTYPE html>
    <meta charset="UTF-8" />
    <meta name="application-name" content="Simple geometric captcha for PHP" />
    <meta name="author" content="Francisco del Aguila." />
    <title>Simple geometric captcha example</title>
if ($sent) {
            if (
$captchaOk) {
            } else {
<h1>Simple geometric captcha example</h1>
    <img src="sgcaptcha.php" style="width:350px;" alt="Captcha" />
    Input the digits inside the key figures.
    (Key figures are the ones equal to the black coloured, at the right)
    <form action="example.php" method="post">
        <input type="text" name="value" size="12" maxlength="12" />
        <input type="submit" value="submit" />
    <span style="font-size:.8em;">
        Copyright &copy; 2014, Francisco del Aguila<br/>
        This software is under the MIT license.<br/>
        See contents of file README.txt for more information.