Hi all, My captha code is working but the session code is not matching image code(captha code).
How do i get them to match each other. PHP CAPTHA session_start(); $fontArray = array('arial.tff' , 'impact.tff' , 'tahoma.tff' , 'tunga.tff' , 'verdana.tff'); $fontOne = md5(rand(0,50)); $fontTwo = md5(rand(0,50)); $fontThree = md5(rand(0,50)); $fontFour = md5(rand(0,50)); //Let's generate a totally random string using md5 $md5_hashOne = md5(rand(0,999)); $md5_hashTwo = md5(rand(0,999)); $md5_hashThree = md5(rand(0,999)); $md5_hashFour = md5(rand(0,999)); //We don't need a 32 character long string so we trim it down to 5 $wordOne = substr($md5_hashOne, 15, 1); $wordTwo = substr($md5_hashTwo, 15, 1); $wordThree = substr($md5_hashThree, 15, 1); $wordFour = substr($md5_hashFour, 15, 1); //Set the image width and height $width = 400; $height = 150; //Create the image resource $image = @imagecreatefromjpeg("CapthaBack.jpg"); $grey = imagecolorallocate($image, 255, 255, 255); imagettftext($image,20, rand(0,70), 30, 30, $grey , 'impact.ttf' , $wordOne); imagettftext($image,20, rand(0,70), 70, 30, $grey , 'impact.ttf' , $wordTwo); imagettftext($image,20, rand(0,70), 110, 30, $grey , 'impact.ttf' , $wordThree); imagettftext($image,20, rand(0,70), 150, 30, $grey , 'impact.ttf' , $wordFour); session_unset($_SESSION["security_code"]); $_SESSION["security_code"] = $wordOne . "" . $wordTwo . "" . $wordThree . "" . $wordFour; header("Content-Type: image/jpeg"); //Output the newly created image in jpeg format ImageJpeg($image); //Free up resources ImageDestroy($image); HTML CODE session_start(); <table> <tr> <td></td> <td colspan="2"><input type="text" name="captha" value=""><?php echo "Test: ".$_SESSION["security_code"] ?></td> </table> Thanks, Stephen -- View this message in context: http://www.nabble.com/Captha-Image-Matching-the-Session-Value.-tp21650616p21650616.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php