PHP Classes

File: gd_example.php

Recommend this page to a friend!
  Classes of Michael Rose   GD Image Verification Class   gd_example.php   Download  
File: gd_example.php
Role: Example script
Content type: text/plain
Description: Example file #2
Class: GD Image Verification Class
Generate CAPTCHA verification images for forms
Author: By
Last change: Changed content type
Date: 17 years ago
Size: 1,101 bytes


Class file image Download
// Velox Letum (2005)

// Require the class code...
require ('gd_image_verify.php');

// Initialize class
$gd = new gd_verification();

if (isset(
$_POST['submit'])) {
    if (
$gd->verify_string($_POST['gd_string'])) {
$result = 'User input matches image string.';
    } else {
$result = 'User input does not match image string.';

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" lang="en" xml:lang="en">
<title>GD Image Verification Class Example</title>
    <div style="text-align:center;">
        <h1>GD Image Verification Class Example</h1>
        <? echo $result; ?><br /><br />
        <form name="gd_verify" method="POST" action="<? echo $PHP_SELF; ?>">
            <img src="gd_image.php" alt="Verification Image" /><br /><br />
            <? echo $gd->output_input_box('gd_string'); ?><br /><br .>
            <input type="submit" name="submit" value="Submit" />