PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of chaabelasri  >  Easy CAPTCHA  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example
Class: Easy CAPTCHA
Generate images for CAPTCHA validation
Author: By
Last change:
Date: 4 years ago
Size: 1,734 bytes
 

Contents

Class file image Download
<?php
  
require_once('captcha.php');
  
session_start();
  
$captcha = new captcha();
  
$_message = '';
   if(isset(
$_REQUEST['Submit'])){
      if(
$captcha->check( $_REQUEST['number'] ) ) {
         
$_message = '<center><font face="Verdana, Arial, Helvetica, sans-serif" color="#66CC00">Your string is valid!</font></center>';

      }else{
         
$_message = '<center><font face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000">Validation string not valid! Please try again!</font></center>';
      }

   }
  
$captcha->createCaptcha();
  
$_urlCaptcha = $captcha->getUrlCaptcha();
?>
<HTML>
<HEAD>
<TITLE>EASY-CAPTCHA </TITLE>
<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">
</HEAD>
<BODY onLoad="return focuson();">

<?php echo $_message ?>
<form name="form1" method="post" action="index.php">
<table width="342" align="center" cellspacing="0" bgcolor="#F2F2F2">
<tr>
  <td colspan="4" align="center"><hr></td>
  </tr>
<tr>
  <td align="center">&nbsp;</td>
  <td align="center">&nbsp;</td>
  <td align="center"><img src="<?php echo $_urlCaptcha ?>"></td>
  <td align="center">&nbsp;</td>
</tr>
<tr>
  <td align="center">&nbsp;</td>
  <td align="center"> Please enter the string shown in the image in the form.<br></td>
  <td align="center"><input name="number" type="text" id=\&quot;number\&quot;></td>
  <td align="center">&nbsp;</td>
</tr>
<tr>
  <td align="center">&nbsp;</td>
  <td align="center">&nbsp;</td>
  <td align="center"><input name="Submit" type="submit" value="Submit"></td>
  <td align="center">&nbsp;</td>
</tr>
<tr>
  <td colspan="4" align="center"><hr></td>
  </tr>
</table>
</form>
</BODY>
</HTML>