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 Mr.Empty  >  PHP Click CAPTCHA  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Click CAPTCHA
CAPTCHA validation checking where the user clicks
Author: By
Last change:
Date: 2013-05-04 20:45
Size: 1,450 bytes
 

Contents

Class file image Download
<?php
include('ClickCaptcha.class.php');
$ClickCaptcha = new ClickCaptcha();

// simple demonstration!
$request = isset($_GET['request']) ? $_GET['request'] : '';
if(
$request=='captcha'){
    
$ClickCaptcha->display();
    
//$ClickCaptcha->display([0-8]);
    //$ClickCaptcha->display([0-8], [3-10]);
    
return;
}else if(
$request=='submit'){
    
$position = isset($_POST['position']) ? $_POST['position'] : array(00);
    
$verifysession $ClickCaptcha->validate($position[0], $position[1]);
    
$verifysession $verifysession?'true':'false';
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <title>ClickCaptcha</title>
    </head>
    <body>
        <div style="TEXT-ALIGN: center">
            <?php if($request=='submit'){ ?><span id="return">
                Captcha: <span><?php echo $verifysession ?></span>, Position: <span><?php echo $position[0].', '.$position[1?></span>
            </span><?php ?>
            <form action="example.php?request=submit" method="POST">
                <input type="image" name="position[]" src="example.php?request=captcha" />
            </form><br />
            <span><a href="example_ajax.php">Ajax&nbsp;&gt;&gt;</a></span>
        </div>
    </body>
</html>