PHP Classes
Icontem

File: example_2.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Costin T  >  AbsCaptcha  >  example_2.php  
File: example_2.php
Role: Example script
Content type: text/plain
Description: Example 2
Class: AbsCaptcha
Generate CAPTCHA validation images
 

Contents

Class file image Download
<?php
/**
* TEST CAPTCHA CLASS
*/
    # No cache headers
    
header("Expires: Mon, 05 June 2001 05:06:07 GMT");
      
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
    
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
    
header("Cache-Control: no-cache, must-revalidate");
    
header("Pragma: no-cache");

    
session_start(); # REQUIRED

// INCLUDE THE CAPTCHA CLASS
    
require("class.AbsCaptcha.php");

// SET THE PATH TO THE DIRECTORY WHERE TO STORE THE IMAGE
    
$dir $_SERVER['DOCUMENT_ROOT'].'/Projects/Captcha/captcha/';

// INSTANTIATE THE CLASS :: change the background and the foreground color

    
$c = new AbsCaptcha('x_session_captcha'$dir'captcha', array(0,0,0), array(255,255,255));

// GENERATE IMAGE
    
$c->GenerateCaptcha();

// DISPLAY THE IMAGE
    
echo '<img src="captcha/'.$c->GetImageName().'" width="'.$c->GetImageWidth().'" height="'.$c->GetImageHeight().'" />';

// DISPLAY THE CODE FROM THE IMAGE
    
echo '<p>code: '.$c->GetCaptchaCode().'</p>';


// uncomment to clear the session.
// session_destroy();
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products