The site breaks, writes:

"page is not available" on all pages of the site

after adding a captcha shape to the view.

My actions on adding a captcha module to the site:

1 Unpacked the module in modules/captcha .

2 Replaced the old version of the request call:

 Request::instance()->headers['Content-Type'] = 'image/'.$this->image_type; Request::instance()->headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'; Request::instance()->headers['Pragma'] = 'no-cache'; Request::instance()->headers['Connection'] = 'close'; 

on new

 Request::current()->headers('Content-Type', 'image/'.$this->image_type); Request::current()->headers('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); Request::current()->headers('Pragma', 'no-cache'); Request::current()->headers('Connection', 'close'); 

3 Connected module in bootstrap.php :

  Kohana::modules(array( // 'debug-toolbar' => MODPATH . 'debug-toolbar', // Basic authentication 'auth' => MODPATH . 'auth', // Basic authentication 'admin' => MODPATH . 'admin', // administration module 'cache' => MODPATH . 'cache', // Caching with multiple backends 'static-files' => MODPATH . 'static-files', // Caching with multiple backends 'database' => MODPATH . 'database', // Database access 'image' => MODPATH . 'image', // Image manipulation 'captcha' => MODPATH . 'captcha', // Captcha 'orm' => MODPATH . 'orm', // Object Relationship Mapping 'I18n_Plural' => MODPATH . 'I18n_Plural', // I18n Plural )); 

4 Created the MainCaptcha.php controller in application/classes/controller :

 <?php defined('SYSPATH') or die('No direct script access.'); class Controller_MainCaptcha extends Controller_Template { public $template = 'main_page'; protected $path, $cur_elem; public function action_index() { if($post = $this->request->post()){ /** Проверяем Каптчу на валидацию */ if(Captcha::valid($post['captcha'])){ // записываем данные в БД, например } } $captcha_image = Captcha::instance()->render(); // выводим наш шаблон $this->template->content = View::factory('MainCaptcha')->bind('captcha_image', $captcha_image); } 

5 In the form in the file main_page.php prescribe a captcha form and after that the site breaks down, and if I remove the form, the site works:

 <form id="goToQuim" method="post" action="/ajax/question"> <label> <input class="inputStyle" required type="text" name="name" value="" placeholder="Ваше имя..."> </label> <label> <input class="inputStyle" required type="text" name="email" value="" placeholder="E-mail..."> </label> <label> <textarea class="inputStyle" required name="question" placeholder="Ваш вопрос..."></textarea> </label> <input type="checkbox" class="agree" style="width:20px;"><a href="/politika_konfidencialnosti" target="_blank">Я прочитал и согласен с Пользовательским соглашением</a> <?php echo $captcha; ?> <label>Введите код указанный на картинке:</label> <?=Form::input('captcha')?> <?=$captcha_image?> <img alt="Обновить код" src="uploads/images/refresh.png" class="refresh" title="Обновить код" /> <label class="labelbtn"><input class="btnStyle continue" type="submit" value="Отправить"></label> </form> 

Maybe I'm doing something wrong or missed something?

    0