I'm trying to use kohana-captcha module for a Kohana 3.3 project. Everything works fine until the validation.
The problem is that Captcha module always shows different answer no matter what image has been generated. Here is the example of my code:
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_User extends Controller_Template {
public $template = "template";
public function action_create()
{
if (isset($_POST['captcha']))
{
print $_POST['captcha'];
print ">>>".Captcha::valid($_POST['captcha'])."<<<";
}
$captcha = Captcha::instance();
$this->template->content = View::factory('user/create')
->bind('captcha', $captcha);
}
}
?>
View code:
<form method="post" action="/user/create/" class="form-horizontal" id="form">
<div class="control-group">
<label class="control-label" for="inputCaptcha">
<?=$captcha?>
</label>
<div class="controls">
<input type="text" id="inputCaptcha" placeholder="Код с картинки" name="captcha">
<span class="help-inline"></span>
</div>
</div>
</form>
$_SESSION and $_COOKIE arrays are also empty.
The point is that I see the captcha image, enter the code, submit a form and then receive nothing. Captcha::valid($_POST['captcha']) shows me nothing. When I try to make print_r($captcha) after Captcha::instance() it shows me an object with a protected "response" property but it contains absolutely different letters and digits.
For example, I see an image with a "KX5R" captcha code, here is the result of print_r($captcha):
Captcha_Alpha Object ( [driver:protected] => [response:protected] => MWXF [image:protected] => [image_type:protected] => png )
Any advices?