Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/10/2013, 10:32
roboty
 
Fecha de Ingreso: abril-2011
Mensajes: 867
Antigüedad: 13 años
Puntos: 5
error en captcha

hola intento crear un captcha pero ma da error pongo codigo por si me podeis ayudar?

Código PHP:
Ver original
  1. <?php
  2. date_default_timezone_set('Europe/Madrid');
  3. $captchaTextSize = 7;
  4. do {
  5.     $md5Hash = md5( microtime( ) * date() );
  6.     preg_replace( '([1aeilou0])', "", $md5Hash );
  7. }
  8. while( strlen( $md5Hash ) < $captchaTextSize );
  9.     $key = substr( $md5Hash, 0, $captchaTextSize );
  10.     $_SESSION['key'] = md5( $key );
  11.     $captchaImage = imagecreatefrompng( "imagenes/captcha.png" );
  12.     $textColor = imagecolorallocate( $captchaImage, 50, 105, 82 );
  13.     $lineColor = imagecolorallocate( $captchaImage, 15, 103, 103 );
  14.     $imageInfo = getimagesize( "imagenes/captcha.png" );
  15.     $linesToDraw = 10;
  16.     for( $i = 0; $i < $linesToDraw; $i++ )  {
  17.         $xStart = mt_rand( 0, $imageInfo[ 0 ] );
  18.         $xEnd = mt_rand( 0, $imageInfo[ 0 ] );
  19.         imageline( $captchaImage, $xStart, 0, $xEnd, $imageInfo[1], $lineColor );
  20.     }
  21.     imagettftext( $captchaImage, 20, 0, 35, 35, $textColor, "fuente/VeraBd.ttf", $key );
  22.     header ( "Content-type: image/png" );
  23.     imagepng( $captchaImage );
  24. ?>