I'm trying to create my own captcha and it's not going so well. My host says everything is installed to run it, so is there something wrong with my code?
Generator.php:
Code: Select all
header("Content-type: image/png");
session_start();
$md5 = md5(microtime() * mktime());
$string = substr($md5,0,5);
$captcha = imagecreatefrompng("captcha.png");
$line = imagecolorallocate($captcha,255,255,255);
$font = imagecolorallocate($captcha,204,204,204);
imageline($captcha,0,0,125,15,$line);
imageline($captcha,0,0,125,20,$line);
imageline($captcha,125,0,0,20,$line);
imagettftext($captcha,20,0,6,10,$font,"Arial.ttf",$string);
$_SESSION['key'] = md5($string);
imagepng($captcha);
imagedestroy($captcha);Code: Select all
<img src="generator.php" border=0>