Captcha needs to be implemented in 2 ways..1) to show the code, 2) to validate the code. See the
documentation for the 2 calls that can be used together:
Quote
getCaptchaNumber($length, $alt='Captcha Number', $title='Security Code')
// returns a Captcha Number image to caller and stores value in $_SESSION['captchNumber']
// $length = number of digits to return
// $alt = alternate text if image cannot be displayed
// $title = message to display for onhover event
validCaptchaNumber($number)
// returns Captcha Number validation back to caller - boolean (true|false)
// $number = number entered by user for validation (example: $_POST['captchaNumber'])
Also, if you want to see an example of how this was implemented, you can refer to the
etComment snippet that has it integrated:
//Initiate Captcha
if($useCaptcha == true && isset($_POST['captchaCode']))
{
$captchaEntry=htmlentities($_POST['captchaCode']);
if(!$etomite->validCaptchaCode($captchaEntry)) {
$captchaError = true;
$errorsOut .=$text['NotValidCaptcha']."<br />";
}
}
if($useCaptcha){
$formArr['captchaInput']='<input type="text" name="captchaCode" />';
$formArr['CaptchaMessage'] = $text['CaptchaMessage'];
$formArr['captcha'] = $etomite->getCaptchaCode();
}
$formChunk .= $etomite->parseChunk($etoCommentForm, $formArr, '{', '}');
If this is too tricky for you to adapt to Guestbook, Ralph may assist.
Edited to fix code block nesting.
This post has been edited by Cris D.: 16 June 2009 - 09:52 PM