我使用脚本Captcha表单(captcha.php)。适用于IE和Firefox,但Chrome在验证期间崩溃。我试图解决,但我们没有。在此先感谢您的支持。
SCRIPT:
<?php
session_start();
function _generateRandom($length=6)
{
$_rand_src = array(
array(48,57) //digits
, array(97,122) //lowercase chars
);
srand (floor(time() / (5*60)));
$random_string = "";
for($i=0;$i<$length;$i++)
{
$i1=rand(0,sizeof($_rand_src)-1);
$random_string .= chr(rand($_rand_src[$i1][0],$_rand_src[$i1][1]));
}
return $random_string;
}
global $captchaimagepath;
$im = @imagecreatefromjpeg($captchaimagepath. "captcha.jpg");
$rand = _generateRandom(3);
$_SESSION['captcha'] = $rand;
ImageString($im, 15, 18, 8, " ".$rand[0]." ".$rand[1]." ".$rand[2]." ", ImageColorAllocate ($im, 0, 0, 0));
/*$rand = _generateRandom(3);
ImageString($im, 15, 18, 8, " ".$rand[0]." ".$rand[1]." ".$rand[2] ." ", ImageColorAllocate ($im, 255, 0, 0));
Header ('Content-type: image/jpeg');
*/
imagejpeg($im,NULL,100);
ImageDestroy($im);