Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/01/2008, 09:14
Avatar de Italico76
Italico76
 
Fecha de Ingreso: abril-2007
Mensajes: 3.303
Antigüedad: 17 años, 1 mes
Puntos: 292
De acuerdo Re: Header: Content-type ? no me imprime nada!

okram: como siempre........ excelente!!!! tenes que escribir un libro de PHP.... yo lo compraría (aunque aceptaria una copia gratis tb)

Código PHP:
<?php
Function pass_gen($len=8){
$string '';
    
$ok false;    
    
$chars 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
    for (
$i 0$i $len$i++){
       
$pos rand(0strlen($chars)-1);
       
$string .= $chars{$pos};
     }
return (
$string);     
}

Function 
captcha($imagen_file){
//header("Content-type: image/png");
//$imagen_file = "captcha.png";
$im = @imagecreate(10050)  or die("Cannot Initialize new GD image stream");

$clave pass_gen();

imagecolorallocate($im000);
$text_color imagecolorallocate($im2331491);
imagestring($im51515,  $clave$text_color);
imagepng($im,$imagen_file);
imagedestroy($im);

return (
$clave);
}


$c =  captcha("captcha.png");
echo 
$c.'<p/>';
echo 
'<img src="captcha.png"/>';


?>
__________________
Salu2!