最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php 验证码生成程序[可自动判断php gd库]
时间:2022-07-02 10:15:10 编辑:袖梨 来源:一聚教程网
php 验证码生成程序[可自动判断php gd库]
function ShowKey()
{
$key=strtolower(domake_password(4));
$set=esetcookie("checkkey",$key);
//是否支持gd库
if (function_exists("imagejpeg")) {
header ("Content-type: image/jpeg");
$img=imagecreate(69,20);
$black=imagecolorallocate($img,255,255,255);
$gray=imagecolorallocate($img,102,102,102);
imagefill($img,0,0,$gray);
imagestring($img,3,14,3,$key,$black);
imagejpeg($img);
imagedestroy($img);
}
elseif (function_exists("imagegif")) {
header ("Content-type: image/gif");
$img=imagecreate(69,20);
$black=imagecolorallocate($img,255,255,255);
$gray=imagecolorallocate($img,102,102,102);
imagefill($img,0,0,$gray);
imagestring($img,3,14,3,$key,$black);
imagegif($img);
imagedestroy($img);
}
elseif (function_exists("imagepng")) {
header ("Content-type: image/png");
$img=imagecreate(69,20);
$black=imagecolorallocate($img,255,255,255);
$gray=imagecolorallocate($img,102,102,102);
imagefill($img,0,0,$gray);
imagestring($img,3,14,3,$key,$black);
imagepng($img);
imagedestroy($img);
}
elseif (function_exists("imagewbmp")) {
header ("Content-type: image/vnd.wap.wbmp");
$img=imagecreate(69,20);
$black=imagecolorallocate($img,255,255,255);
$gray=imagecolorallocate($img,102,102,102);
imagefill($img,0,0,$gray);
imagestring($img,3,14,3,$key,$black);
imagewbmp($img);
imagedestroy($img);
}
else {
$set=esetcookie("checkkey","ebak");
@include("class/functions.php");
echo ReadFiletext("images/ebak.jpg");
}
}
ShowKey();
相关文章
- 地铁最后的曙光免费领取地址分享 05-08
- 奇迹暖暖九周年充值福利有什么 05-08
- 恋与深空曦光再临怎么玩 05-08
- 闪耀暖暖尘封的金色王朝复刻怎么玩 05-08
- 重返未来1999必胜客联动怎么玩 05-08
- 奇迹暖暖凛霜魔法怎么样 05-08