在codeigniter中设置会话加载

I understand codeigniter sets up sessions for you if you load the library. However, I want to have my own set of rules. I thought I could do it by adding userdata and checking to see if its exists on each page load. However, its not working...

Here is my welcome controller...

class Welcome extends CI_Controller
{
    function __construct()
    {
        parent::__construct();

        //$this->output->enable_profiler(TRUE);

        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');
        $this->load->library('session');
        $this->load->helper('url');
    }

    function index($cliqid='', $cliq=false)
    {
        $default_cliq = 5; //this equals whatever the user sets
        $this->page_m->load_session($default_cliq); //check to see if session is new; if so, perform list of actions
        //$this->session->sess_destroy();
        print_r($this->session->all_userdata());
    }
}

It points to page_m which consists of the load session method where I want to apply some session variables to be used throughout the visitor's stay on the page:

Here is a brief excerpt:

class Page_m extends CI_Model
{
function __construct()
{
    parent::__construct();
    $this->load->model('cliq_info_m');
}

function load_session($default_cliq)
{
    //check if session is new
    if ($this->session->userdata('exists') == true) {
        //the list of things to do
        $this->record_session();   //check if ip exists in DB, if not, record     
        $this->cliq_info_m->change_active($default_cliq);

        //make session old
        $data['exissts'] = true;
        $this->session->set_userdata($data); 
    } else {
        return false;
    }
}

What happens...is it runs this every time, regardless of the 'exists' variable.

Anyone know why? And a possible solution?

It appears that the reason for the error was the fact that I had heading errors (echoing the script alert). Once i removed all that, it started working...