Author Topic: Captcha not working correctly  (Read 9496 times)

0 Members and 1 Guest are viewing this topic.

trojan

  • Jr. Member
  • **
  • Posts: 1
Captcha not working correctly
« on: June 28, 2010, 08:59:45 PM »
Hello,

I am new to the forum and I came across an issue which I thought I could share and help.
The captcha used to "leave message" did not work correctly. It would take any input and as long as there was something entered in the text, it would accept it.
Upon debugging I saw it was comparing the same text to itself ( line 86:/leavemessage.php ).
$_SESSION['captcha'] contained the "entered text" instead of the "original text" in the captcha image.

Fix:
1. Modify /captcha.php modify line: 26 FROM $_SESSION["captcha"] = $captchaCode;    TO    $_SESSION["captchaCode"] = $captchaCode;
2. Modify /leavemessage.php line: 86 FROM $original = isset($_SESSION['captcha']) ? $_SESSION['captcha'] : "";      TO      $original = isset($_SESSION['captchaCode']) ? $_SESSION['captchaCode'] : "";

Somehow it was not working correctly with the Session variable named "captcha". May be coz the input text box is also named 'captcha'. I am not sure of this reason.
But above is how I fixed it. Hope it helps.

Thanks & Sorry if I have shared something you guys already knew.
Thanks.