PHP Tutorial : How to validate the captcha (II)
Dec 20, 2008 Useful PHP
In the last tutorial I teached you how to generate a security image with php called captcha code. Also I teached you how to store that random security photo / image code in a php session : with a reason, to be able to validate it later. So here we are , on the page which action is pushed we do this to validate the captcha :
<?php session_start(); if(isset($_SESSION['randomcode'])) { //check if what user typed in input equals to session key >if(md5($_POST['inputname']) == $_SESSION['randomcode']) { print "GOOD, captcha correct!"; }else{ print "You didn't entered the captcha correct"; } } ?>


Leave a Reply