不需要gd库的情况下实现验证码
//| 验证页面对比
//| $_cookie[validate] == md5($_post[input])
//|==================config start===================
$image_path=numimage;// 图片文件路径 后面没有/
$image_ext =gif;// 图片文件扩展名
//===================config end=====================
$imagelist = array();
if ($handle =opendir($image_path)) {
while (false !== ($file =readdir($handle))) {
$filename =explode(.,$file);
$imagelist[] = $filename[0];
unset($filename);
}
closedir($handle);
unset($imagelist[0]);
unset($imagelist[1]);
}
srand((float)microtime()*103e//| 引用 (%e5%81%9a%e4%b8%ba%e7%8e%b0%e5%9c%a8%e7%9a%84%e4%b8%bb%e6%b5%81%e5%bc%80%e5%8f%91%e8%af%ad%e8%a8%80)>
//| 验证页面对比
//| $_cookie[validate] == md5($_post[input])
//|==================config start===================
$image_path=numimage;// 图片文件路径 后面没有/
$image_ext =gif;// 图片文件扩展名
//===================config end=====================
$imagelist = array();
if ($handle =opendir($image_path)) {
while (false !== ($file =readdir($handle))) {
$filename =explode(.,$file);
$imagelist[] = $filename[0];
unset($filename);
}
closedir($handle);
unset($imagelist[0]);
unset($imagelist[1]);
}
srand((float)microtime()*10000000);
$filename=$imagelist[array_rand($imagelist)];
setcookie(validate,md5($filename));
header(content-type: application/.$image_ext);
echo implode(,file($image_path./.$filename...$image_ext));
?>
http://www.bkjia.com/phpjc/508692.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/508692.htmltecharticle不需要gd库的情况下实现验证码 ?php (做为现在的主流开发语言) //+------------------------------------------------- //| * 文件 validate_image.php (做为现在的...