/ Published in: PHP
URL: http://vladimir-ivanov.net
Tell the users to enter only the red or only the blue digits, not everything they see. Most bots will try to enter everything, displayed on the images. To check is captcha code entered correctly, use $SESSION['captcha']['red'] to check the red digits only and $SESSION['captcha']['blue'] to check the blue digits only. Good luck !
Expand |
Embed | Plain Text
$width = 146; $height = 30; imagecolorallocate($im, 255, 250, 255); $noise_color = imagecolorallocate($im, 207, 239, 250); for($i=0; $i<($width*$height)/3; $i++) { } /* generate random lines in background */ for($i=0; $i<($width*$height)/150; $i++ ) { } $text_color[0] = imagecolorallocate($im, 255, 0, 0); $text_color[1] = imagecolorallocate($im, 51, 166, 207); $_SESSION['captcha']['blue'] = $_SESSION['captcha']['red'] = ''; imagettftext($im, 20, 0, 5+($j*23), 24, $text_color[$j%2], './offshore.ttf', $text[$j]); if(($j%2) == 1) { $_SESSION['captcha']['blue'] .= $text[$j]; } else { $_SESSION['captcha']['red'] .= $text[$j]; } } imagepng($im); imagedestroy($im);
You need to login to post a comment.
