Session unsets, can't find why or where

#1
[eluser]Unknown[/eluser]
Hi!

For some reason the session variable 'deck' unsets or is getting set to false. I can't find why it does that, or where, and I frankly don't know where to look anymore.

Where should I start looking? It worked at first but not anymore.

I've included my code in question. Please help me here.

Code:
<?php

class Site extends Controller {

    public function index() {

    if(!$this->session->userdata('deck')) {
        $deck = $this->_load_deck('lolcats');
        $this->session->set_userdata('deck', $deck);
    } else {
        $deck = $this->session->userdata('deck');
    }

    $data['deck'] = $deck;

    $this->load->view('main', $data);


    }

    public function _load_deck($version) {

    $deck = $this->session->userdata('deck');

    if(!$deck) {

        $image_dir = APPPATH . '../game_images/' . $version;
        $tb_dir = APPPATH . '../game_thumbs/' . $version;

        $images = get_filenames($image_dir);
        $thumbs = get_filenames($tb_dir);

        foreach($images as $key => $image) {
        $image_path = base_url() . 'game_images/' . $version . '/' . $image;
        $tb_path = base_url() . 'game_thumbs/' . $version . '/' . $thumbs[$key];
        $deck[$key] = array(
            'image_name' => $image,
            'full_image_path' => $image_path,
            'thumb_image_path' => $tb_path,
            'hash' => sha1($image)
        );

        shuffle($deck);

        }

        shuffle($deck);

        $tmp_deck = $deck;
        $deck = array_merge($deck, $tmp_deck);
        shuffle($deck);

        return $deck;

    }

    return false;

    }

}

Edit:

It turned out I was storing too much data in the session-cookie. I switched to database-sessions and that solved it Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.