不需要GD庫的情況下實現驗證碼
//+-------------------------------------------------
//| * 檔案 validate_image.php(做為現在的主流開發語言)
//| * 功能 實現網站登陸驗證碼
//| * 版本 1.0.0
//| * 日期 2005-4-1
//| * 作者 西北狼 QQ 500784 cokeyang at hotmail.com
//| * 著作權 http://www.adibaby.com[暫時關閉]
//| * 使用方法:
//| 預先在支援GD庫的做好一些圖片,推薦使用GIF格式,檔案名稱與圖片裡
//| 面的裡面的數字一致,將圖片放入一個檔案夾。設定CONFIG裡面的資料.
//| 引用
//| 驗證頁面對比
//| $_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//| 引用
//| 驗證頁面對比
//| $_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 (做為現在的...