I can't seem to get this to work. Even if I type in the correct string, I still get the error. Here is my code:
include 'lib/config.php';
connect();
session_start();
$RandomStr = md5(microtime());
$ResultStr = substr($RandomStr,0,5);
$NewImage =imagecreatefromjpeg("lib/images/img.jpg");
$LineColor = imagecolorallocate($NewImage,233,239,239);
$TextColor = imagecolorallocate($NewImage, 255, 255, 255);
imageline($NewImage,1,1,40,40,$LineColor);
imageline($NewImage,1,100,60,0,$LineColor);
imagestring($NewImage, 5, 20, 10, $ResultStr, $TextColor);
$_SESSION['key'] = $ResultStr;
$key=substr($_SESSION['key'],0,5);
if($number != $key) {
Message("Image Verification Failed", "The characters that you have entered do not match. Please try again.");
}
My form code is:
<img src=\"captcha.php\"> <input type=\"text\" name=\"number\" size=\"5\">
Please help me.