CodeIgniter Forums

Full Version: Using flashdata before userdata
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I have a login page that sets userdata once the user has logged in successfuly like this:

if (user_authenticated())
    $session_data['auth'] = TRUE;
    $session_data['userid'] = FGT01932434;

I have found though, that if I use 'set_flashdata()' before I use set_userdata().. and then redirect(), the user data is never set. I thought it may be a problem with the redirect, but no.. if I do not set the flash data, everything works as expected.

I am using this to store form data before setting the userdata:

$this->session->set_flashdata('form_data', '$formdata');

Anyone come across this issue?

El Forum

No, and pretty weird, since set_flashdata uses set_userdata to store the session variable.

Are you using cookie based sessions by any chance? They are limited in size, it could be that if you add flashdata before, the userdata doesn't fit anymore.