Welcome Guest, Not a member yet? Register   Sign In
captch & sessions

Hi all,
this is my first project with CI & i have encountered a weird problem.
i am using an AUTH class with captcha, i store the captcha string in a session
but for some reason the session string changes & is not cmpatible with the captcha string.

if (isset($_POST['submit'])){
    // check captch string
    if($this->session->userdata('cap_code') != $_POST['security_code'] ){
        $data['err'] = 'no match';


// Generate captch code & insert into session
$data['code'] = $this->_generateCode();

any ideas?

Hi! I have similar problem, but im using flash_sessions. Captcha (flash session data) works just in first passing through form:

CommentForm -> submit -> it works, then refresh the CommentPage with CommentForm -> submit -> doesnt work, flash_session is empty.

And when i access page with form standard way (from some referer page, not just via redirect), it works again.

Any ideas anyone? Thanks in advance!

yeah, i tried it with the flashdata as well & no good.

my theroy is that is has something to do with the sesssion 'sess_time_to_update', but not sure if that is true & even if it is what exactly is the problem.

Hey, i think i got it! When i woke up this morning, think came :-D.
So, im trying to write to the same variable, from which im reading at the same request. That is the problem, there must exist some mechanism, which cleans up that variable before next request. So i see solution in that - to use "normal" session and after use just clean that up and set again, or generate random name for that flashdata. (or use standard way via database ;-)).

So i think, my problem is solved, im gonna to test it out!

not sure i undestood,
can you post your code?

hi, sory for long time...i was ill :-)
im going to write that code yet, and as i can see, its similar to your code :-(. so i'll try it and then write some result

Hope you feel better,
i have left it for a while, so any new ideas will be good.

Theme © iAndrew 2016 - Forum software by © MyBB