Yo generé este captcha, espero te funcione
Código PHP:
session_start();
$rand1 = rand('10', '99');
$rand2 = rand('10', '99');
$rand3 = rand('10', '99');
$rand4 = rand('10', '99');
$rand5 = rand('10', '99');
$rand6 = rand('10', '99');
$codigoaleatorio = 'E3' .$rand1. 'fh' .$rand3. 'IA' .$rand5. '4d' .$rand2. 'Kj' .$rand4. 'm9' .$rand6. 'ir' .$rand1. 'Qp' .$rand3. 'N1' .$rand5. 'aZ' .$rand2. 'gc' .$rand4. 'eT' .$rand6. 'Ut' .$rand1. 'wL' .$rand3. 'F6' .$rand5. 'XM' .$rand2. 'nk' .$rand4. 'D5' .$rand6. 'BG' .$rand1. '7Y' .$rand3. 'bJ' .$rand5. 'lP' .$rand2. '8q' .$rand4. 'sR' .$rand6. '2C' .$rand1. 'HW' .$rand3. 'y0' .$rand5. 'u0' .$rand2. 'xs' .$rand4. '';
$code = substr($codigoaleatorio, mt_rand(0, strlen($codigoaleatorio)-1), 4);
$text = $code ;
$_SESSION["code"] = $text;
$height = 20;
$width = 44;
$image_p = imagecreate($width, $height);
$black = imagecolorallocate($image_p, 255, 255, 255);
$white = imagecolorallocate($image_p, 61, 90, 90);
$font_size = 10;
imagestring($image_p, $font_size, 5, 2, $text, $white);
imagegif($image_p);
lo pongo asi:
Código HTML:
<img src="captcha.php" align="top" title="Captcha" name="Captcha">