digitalLotus Posted April 18, 2007 Share Posted April 18, 2007 Alright, I've posted this before in the "PHP Help" forum, however this post probably belongs better here. I've been searching for an image verification script i can use for my registration form and found this one ( added below ). The only problem I somehow have is the fact that no matter what code I enter, it's accepted as correct and I receive the response "You are verified". I might as well also point out that I'm quite new on the PHP platform. verification.php: <?php Header("Content-Type: image/png"); session_start(); $new_string; session_register('new_string'); echo "<html><head><title>Verification</title></head>"; echo "<body>"; $im = ImageCreate(200, 40); $white = ImageColorAllocate($im, 255, 255, 255); $black = ImageColorAllocate($im, 0, 0, 0); srand((double)microtime()*1000000); $string = md5(rand(0,9999)); $new_string = substr($string, 17, 5); ImageFill($im, 0, 0, $black); ImageString($im, 4, 96, 19, $new_string, $white); ImagePNG($im, "verify.png"); ImageDestroy($im); echo "<img src=\"verify.png\">"; echo "<br><br>"; echo "Type the code you see in the image in the box below. (case sensitive)"; echo " <form action=\"formhandler.php\" method=post>"; echo "<input name=\"random\" type=\"text\" value=\"\">"; echo "<input type=\"submit\">"; echo "</form>"; echo "</body>"; echo "</html>"; ?> formhandler.php: <?php session_start(); $random = trim($random); if ($new_string == $random){ echo "You are verified"; } else{ echo "Please go back and get verified."; } ?> Thanks in advance for any help. Cheers. Quote Link to comment Share on other sites More sharing options...
digitalLotus Posted April 18, 2007 Author Share Posted April 18, 2007 Alright, it was solved here thanks to HeyRay2. Cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.