Hi Richard, my example is not safe, but already I wrote in the last part of 
my message to Ricardo that, by security, would be necessary to make use of 
session variables, for example, to pass the value of catpcha generated and 
to be able to compare it.

The modification would be like this:

<?php
session_start();
$key = strtolower(substr(md5(rand()), 0, 4));
$_SESSION['captcha'] = $key;

 $im = imagecreatetruecolor(40, 20);

 $bg = imagecolorallocate($im, 0, 0, 0);
 $col_text = imagecolorallocate($im, 255, 255, 255);

 imagestring($im, 4, 4, 1, $key, $col_text);

 header('Content-type: image/png');
 imagepng($im);
 imagedestroy($im);

?>

And the comparison would be between the value introduced by the user and the 
stored one in the session variable.

Saludos,

Julio Barroso 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to