I create a wordpress plugin. This plugin show a submit form in wordpress theme. i use this php captcha code in my wp plugin:
function create_image() {
$md5_hash = md5(rand(0,999));
$security_code = substr($md5_hash, 15, 5);
$_SESSION["security_code"] = $security_code;
$width = 100;
$height = 35;
$image = ImageCreate($width, $height);
$white = ImageColorAllocate($image, 255, 255, 255);
$black = ImageColorAllocate($image, 2, 0, 0);
$blue = ImageColorAllocate($image, 87, 20, 186);
$grey = ImageColorAllocate($image, 204, 204, 204);
ImageFill($image, 0, 0, $blue);
ImageString($image, 5, 30, 8, $security_code, $white);
ImageRectangle($image,0,0,$width-1,$height-1,$grey);
header("Content-Type: image/jpeg");
Imagepng($image);
ImageDestroy($image);
}
and use captcha in img tag:
<img class="captcha" src="<?php create_image() ?>">
But when i use this plugin in my theme, don't worked!