
Abius X - 2014-09-11 19:51:37 -
In reply to message 1 from Bill Konz
I probably should add an example for that! Your question is very valid.
Please vote for the innovation award on PureTextRender package if you think this class is innovative (its just a wrapper around that, less than 50 lines!)
As seen in the example:
require_once __DIR__."/pure_captcha.php";
$k=new PureCaptcha();
$captchaToken=$k->show();
You just need to store $captchaToken variable in your session, probably by:
$_SESSION['captcha']=$captchaToken;
Then whenever you need to validate it, just check if it matches user input. Don't forget, whether it matches or not, you should invalidate it as every captcha should be only valid for one try. So :
if ($_SESSION['captcha']==$userInput)
//do stuff here
unset($_SESSION['captcha']);