Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/03/2010, 00:08
Avatar de zerpico_01
zerpico_01
 
Fecha de Ingreso: enero-2008
Ubicación: Wilde - Avellaneda -
Mensajes: 421
Antigüedad: 18 años, 10 meses
Puntos: 13
Respuesta: crear captcha



http://www.forosdelweb.com/f18/captcha-php-704556/

usa el mas utilizado



http://www.phpcaptcha.org/

pero realmente es sencillo hacerlo

Código PHP:
function captcha(){
        
$md5 = md5(microtime() * mktime());
        
$string = substr($md5,0,5);
        
$_SESSION['key'] = $string;

        
header("Content-type: image/png");
        
$im = imagecreatetruecolor(198, 48);
        
$bg = imagecolorallocate($im, 255, 255, 255);
        
imagefilledrectangle($im, 34, 2, 139, 199, $bg);
        
$fonts = "fonts/Blazed.ttf";
        
        
$izq = 98/2 - 42;
        
$t_color = imagecolorallocate($im, mt_rand(0,100), mt_rand(0,100), mt_rand(0,100));
        
imagettftext($im, 29, 1, $izq, 42, $t_color, $fonts, $string);
        
imagepng($im);
    } 
solo debes cargar la fonts en la carpeta.... aun que la validacion es otro tema mejor usa secureimagen !

saludos!!

Última edición por zerpico_01; 16/03/2010 a las 00:14