Sometimes captcha generates an error if the session is accessed after there is some output in the response. From now on the captcha phrase will be saved first and then there will be the image output.

This commit is contained in:
Alex Tselegidis 2016-01-01 20:34:42 +01:00
parent 0b43e4d918
commit f88c6cb898

View file

@ -32,8 +32,9 @@ class Captcha extends CI_Controller {
public function index() {
header('Content-type: image/jpeg');
$builder = new Gregwar\Captcha\CaptchaBuilder;
$builder->build()->output();
$builder->build();
$this->session->set_userdata('captcha_phrase', $builder->getPhrase());
$builder->output();
}
}