<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);
?>