<?php
session_start();
$captcha = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),0,4);
$_SESSION['captcha'] = $captcha;
$gambar = imagecreate(100,100);
$wk=imagecolorallocate($gambar,255,222,173);
$wt=imagecolorallocate($gambar,0,0,0);
$rand = rand(1,60);
imagefilledrectangle($gambar,0,0,50,20,$wk);
imagestring($gambar,10,$rand,$rand,$captcha,$wt);
imagejpeg($gambar);
?>