Captcha merupakan singkatan dari ?Completely Automated Public Turing test to tell Computers and Humans Apart? ( Wikipedia ). dan dibuat untuk membedakan antara mesin ( bot ) dan manusia dengan cara mem-validasi sebuah inputan.
Kenapa harus divalidasi? soalnya banyak banget program2 SPAM COmment yang bisa aja menyerang situs kita. Kebayang kan klo kita bikin website, terus isi dari Comment/guestbook di website kita itu isinya Link2 ad ato penawaran tentang produk ato ga link gak jelas. Jadi gak sedap dipandang. Biasanya yg ngisi Comment adalah program yang secara otomatis melakukan submit ke buku tamu / halaman comment website/blog kita.. Nah, klo pernah kejadian kayak gitu ato ga ngeliat yang kayak gitu, sebaiknya lengkapi websitenya dengan Captcha.
Captcha = Gambar Samar2
Simpelnya, Captcha merupakan sebuah gambar (image) yang berisi Angka / Teks atau kombinasi Angka & teks yang disamar2kan bentuk & rupanya sehingga memerlukan ketelitian dari pengunjung / orang yang ingin melakukan inputan data disebuah website???.
by ainkdast
http://ainkdast.web.id/2009/03/chaptcha-image-penjumlahan/Mungkin kamu-kamu semua udah tau cara bikin chaptcha kaya gambar ini

kamu-kamu tinggal include file captchasecurityimages.php yang berkeliaran di mbah google??hehe??..
Nah di sini ipank mo ngasih tau ( yang udah tau jangan marah y?hehe? ) klo captchasecurityimages.php itu bisa di modif lho jadi bukan cuma kombinasi huruf ma angka doank tapi bisa juga buat Chaptcha Penjumlahan kaya gini

Nih Kode hasil modifikasi file captchasecurityimages.php :
<?php session_start();
class CaptchaSecurityImages {
var $font = 'monofont.ttf';
function CaptchaSecurityImages($width='220',$height='40',$characters='4') {
$possible = '123456789';
$op1 =substr($possible, mt_rand(0, strlen($possible)-1), 1);
$op2 =substr($possible, mt_rand(0, strlen($possible)-1), 1);
$code = '';
$jawab = $op1+$op2;
$code .= $op1."+".$op2."=";
/* font size will be 75% of the image height */
$font_size = $height * 0.75;
$image = @imagecreate($width, $height) or die('Cannot Initialize new GD image stream');
/* set the colours */
$background_color = imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 20, 40, 100);
$noise_color = imagecolorallocate($image, 100, 120, 180);
/* generate random dots in background */
for( $i=0; $i<($width*$height)/3; $i++ ) {
imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color);
}
/* generate random lines in background */
for( $i=0; $i<($width*$height)/150; $i++ ) {
imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);
}
/* create textbox and add text */
$textbox = imagettfbbox($font_size, 0, $this->font, $code);
$x = ($width - $textbox[4])/2;
$y = ($height - $textbox[5])/2;
imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code);
/* output captcha image to browser */
imagejpeg($image);
imagedestroy($image);
$_SESSION['jawab'] = $jawab;
}
}
$width = isset($_GET['width']) ? $_GET['width'] : ?120′;
$height = isset($_GET['height']) ? $_GET['height'] : ?40′;
$characters = isset($_GET['characters']) ? $_GET['characters'] : ?6′;
header(?Content-Type: image/jpeg?);
$captcha = new captchasecurityimages($width,$height,$characters);
?>
ini kode yang manggil (index.php)
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Captcha Penjumlahan</title>
</head>
<body>
<?php
if(isset($_POST['aksi'])){//1
if ($_SESSION[jawab] == $_POST[jawab] && !empty($_SESSION[jawab]))
{//3
$msg = "Kode Validasi Anda Benar........";
}
else {//7
$error = 'Kode Validasi Yang Anda Masukkan Salah...';
}//7
}
?>
<?php if(isset($error)){?><font color="#FF0000" size="+2"><?php echo $error;}?><br><br></font>
<?php if(isset($msg)){ echo $msg;} else {
?>
<h3>Masukkan Kode Validasi</h3>
<form method="post" action="">
<table border="0">
<tr><td>kode Validasi : <br /><img src="./captchasecurityimages.php?width=100&height=40&character=5" /></td></tr>
<tr><td><input name="jawab" type="text" class="input" size="11" /></td></tr>
<tr><td><input name="aksi" type="submit" class="tombol" value="Simpan" /></td></tr>
</table>
</form>
<?php }
?>
</body>
</html>
Dan Klo Yang Mo Script lengkap ama file monofont.ttf nya yang ada di
http://ainkdast.web.id/chaptcha/