Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/08/2011, 01:32
Hamil
 
Fecha de Ingreso: octubre-2009
Mensajes: 54
Antigüedad: 14 años, 5 meses
Puntos: 2
Seguridad en CAPTCHA

Tengo un codigo para generar captcha que encontre aqui por los foros, en solo 3 dias de abrir una web ya estoi reciviendo mensajes muy extraños en ingles. Como puedo mejorar el codigo?

El codigo introducido en el formulario se comprueba con $_SESSION['key']


Archivo php_captcha:
session_start();

$RandomStr = md5(microtime());// md5 to generate the random string

$ResultStr = substr($RandomStr,0,5);//trim 5 digit

$NewImage =imagecreatefromjpeg("imagenes/img-captcha.jpg");//image create by existing image and as back ground

$LineColor = imagecolorallocate($NewImage,233,239,239);//line color
$TextColor = imagecolorallocate($NewImage, 255, 255, 255);//text color-white

imageline($NewImage,1,1,40,40,$LineColor);//create line 1 on image
imageline($NewImage,1,100,60,0,$LineColor);//create line 2 on image

imagestring($NewImage, 5, 20, 10, $ResultStr, $TextColor);// Draw a random string horizontally

$_SESSION['key'] = $ResultStr;// carry the data through session

header("Content-type: image/jpeg");// out out the image

imagejpeg($NewImage);//Output image to browser


Saludos.