Login   Register  
PHP Classes
elePHPant
Icontem

File: animatedcaptcha_example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of dicky kurniawan  >  Animated Simple CAPTCHA  >  animatedcaptcha_example.php  >  Download  
File: animatedcaptcha_example.php
Role: Example script
Content type: text/plain
Description: Example - Main
Class: Animated Simple CAPTCHA
Generate a CAPTCHA validation animated image
Author: By
Last change:
Date: 6 years ago
Size: 870 bytes
 

Contents

Class file image Download
<?php
require_once(dirname(__FILE__).'/animatedcaptcha.class.php');

$user_guess='';
if (isset(
$_POST['user_guess'])) {
    
$user_guess=$_POST['user_guess'];
}

$img=new animated_captcha();
$img->session_name='my_turing_test';
$img->magic_words('i am cool');

$valid=$img->validate($user_guess);
?>
<html>
<head><title>Animated Captcha Test</title></head>
<body>
<img alt="animated captcha" src="./animatedcaptcha_generate.php?i=<?php echo(md5(microtime()));?>" />
<form method="post">
Image Text = <input type="text" name="user_guess" autocomplete="off" /><br />
<input type="submit" value="Check" />
</form>
<?php
if ($user_guess=='') {
    echo(
'<p>Fill the input !</p>');
} else if (
$valid) {
    echo(
'<p>Correct. You are 100% human being !</p>');
} else {
    echo(
'<p>Invalid text. Are you a human ? Do you eat electricity ?</p>');
}
?>
</html>