Welcome Guest, Not a member yet? Register   Sign In
Kcaptcha session vars not being set
#1

[eluser]bmgz[/eluser]
I am trying to use Kcaptcha with codeigniter. I created a function in the controller to output the image but the session var is not being set afterwards:

controller:

Code:
function captcha(){
    $this->load->library(array('session', 'kcaptcha/kcaptcha'));
    $this->session->set_userdata('captcha_keystring', $this->kcaptcha->getKeyString());
}

view:

Code:
<img src="quiz/captcha" />

When I disable the image headers and image output on the kcaptcha class, then the captcha session var is set, but when they are enabled the session variable is not set?


this is the tail of the Kcaptcha class..

Code:
...
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
        header('Cache-Control: no-store, no-cache, must-revalidate');
        header('Cache-Control: post-check=0, pre-check=0', FALSE);
        header('Pragma: no-cache');
        
        if(function_exists("imagejpeg")){
            header("Content-Type: image/jpeg");
            imagejpeg($img2, null, $jpeg_quality);
        }else if(function_exists("imagegif")){
            header("Content-Type: image/gif");
            imagegif($img2);
        }else if(function_exists("imagepng")){
            header("Content-Type: image/x-png");
            imagepng($img2);
        }
        
    
    }

    // returns keystring
    function getKeyString(){
        return $this->keystring;
    }


Messages In This Thread
Kcaptcha session vars not being set - by El Forum - 07-26-2009, 05:15 AM
Kcaptcha session vars not being set - by El Forum - 07-26-2009, 05:37 AM
Kcaptcha session vars not being set - by El Forum - 07-26-2009, 06:40 AM
Kcaptcha session vars not being set - by El Forum - 07-26-2009, 07:23 AM
Kcaptcha session vars not being set - by El Forum - 07-26-2009, 08:20 AM
Kcaptcha session vars not being set - by El Forum - 07-26-2009, 08:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB