一个小的动态验证

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Picture Verfication</title>
</head>
<body background="../image/1.jpg"  style="font-size:16px; color:#000099;
font-family:'宋体'">
<table width="166" border="1" align="center" bordercolor="#CCCCCC"
bordercolorlight="#FFFFFF">
<tr>
<td width="156" height="139">
<img src="image/1.jpg" hspace="4" border="0" usemap="#Map"><br>

<form action="" method="">
	Verification Code:<input name="text" type="text" size="8">
	<?php
		switch($_GET['link'])
			{
				case "文字";
			
	?>
	<img src="cha.php">
	<?php
				break;
				case "数字";
	?>
	<img src="pic.php">
	<?php
				break;
				default;
	?>
	<img src="pic.php">
	<?php
		}
	?>
</form>
</td>
</tr>
</table>
<map name="Map">
	<area shape="rect" coords="14,47,54,67" href="61.php?link=文字">
	<area shape="rect" coords="91,45,132,66" href="61.php?link=数字">
</map>
</body>
</html>


这里是cha.php代码:

<?php
	header("Content-type:text/html; charset=UTF-8");
	header("Content-type:image/gif");
	$image=imagecreatetruecolor(80,30);
	$font='Font/FZHCJW.TTF'; //The difinition of font
	$bg=imagecolorallocate($image,255,255,255);
	$color=imagecolorallocate($image,255,0,255);
	imagettftext($image,20,0,8,20, $color, $font,"mrsoft");
	imagegif($image);
?>

这里是pic.php代码:

<?php
	header("Content-type:image/gif");
	$image=imagecreatetruecolor(40,20);
	$bg=imagecolorallocate($image,255,255,0);
	$color=imagecolorallocate($image,255,0,255);
	for($b=0;$b<4;$b++)
{
	$a.=rand(1,9);
}
imagestring($image,3,8,5, $a, $color);
imagegif($image);
?>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值