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 Julien PACHET  >  OCR CAPTCHA  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: test the class
Class: OCR CAPTCHA
Generate images to test whether the user is human
Author: By
Last change:
Date: 2004-03-17 02:54
Size: 1,112 bytes
 

Contents

Class file image Download
<?
require_once("./class_ocr_captcha.inc.php");
////////////////////////////////////////////////////////////////
  
  
echo "<a href=example.inc.php>refresh</a><br>\n";
  
// get params
  
if (isset($HTTP_POST_VARS['public_key']))
    
$public=$HTTP_POST_VARS['public_key'];
  if (isset(
$HTTP_POST_VARS['private_key']))
    
$private=$HTTP_POST_VARS['private_key'];
    
  
$p=new ocr_captcha();
  if (isset(
$HTTP_POST_VARS['private_key'])) { // if params, the check captcha private key, from public key
    
echo "We test that private key $private you have just wrote is valid (correspond to the public key $public)<br>\n";
    if (
$p->check_captcha($public,$private))
      echo 
"OK";
    else
      echo 
"nOK";
  }
  echo 
"<form name=form1 action=example.inc.php method=POST>\n";
  echo 
$p->display_captcha(true);
  echo 
"<br>\n";
  echo 
"The public key is: ",$p->public_key,"also in a hidden input in source script<br>\n";
  echo 
"<input type=text name=private_key value='' maxlength=6 size=6><br>\n";
  
$private=$p->generate_private();
  echo 
"<input type=submit value='Valider'>";
  
?>