Improve generation of CAPTCHA images

This commit is contained in:
Fedor A. Fetisov 2013-09-13 22:56:01 +04:00
parent 8bb1551f7a
commit 13729dac93

View File

@ -22,8 +22,12 @@ function can_show_captcha()
function gen_captcha() function gen_captcha()
{ {
$md5_hash = md5(rand(0, 9999)); $symbols = 'abcdefghijkmnpqrstuvwxyz123456789';
return substr($md5_hash, 15, 5); $string = '';
for ($i = 0; $i < 5; $i++) {
$string .= substr($symbols, mt_rand(0, strlen($symbols)), 1);
}
return $string;
} }
function draw_captcha($security_code) function draw_captcha($security_code)