CodeIgniter Forums
php sessions generate many files for the application - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: php sessions generate many files for the application (/thread-51345.html)



php sessions generate many files for the application - El Forum - 04-30-2012

[eluser]joe_h[/eluser]
A greeting my friends, I have the following problem, I have defined a controller that is responsible for the sessions but when I create the application that the user accessed from the login form, I create multiple files (as creating multiple sessions), which may be this

My controllers is:

Code:
class Login extends CI_Controller {
    var $SID;

    function __construct()
    {
        parent::__construct();
        $this->load->library('session');
        $this->SID = SID;
    }

    public function index(){
        $this->load->view('inicio');
    }

    public function createSession($user){
        if($this->SID != ''){
            $this->loadViews($user);
        }else
            redirect( '/' );    // redirect back to login page
    }

    public function loadViews($user){
        $this->load->view('evento');
        $this->load->view('municipios');
        $this->load->view('paloma');
        $this->load->view('palomero');
        $this->load->view('org_masas');
        $this->load->view('productos');
        $this->load->view('provincia');
        $this->load->view('suelta');
        $this->load->view('ventas');
        $this->load->view('palomas_eventos');

        $data["usuario"] = $user;
        $data["SID"] = $this->SID;
        $this->load->view('index_aplication',$data);
    }

    public function logout()
    {
        $this->session->destroy();
        redirect('/', 'refresh');
    }
}

as well as destroys the session, which redirected to the initial view and I click the back button of the browser, re-creates the session and goes directly?

As might fix this?



php sessions generate many files for the application - El Forum - 04-30-2012

[eluser]CroNiX[/eluser]
The back button isn't recreating the session, it's showing you what your browser stored in cache for the last page accessed, which is normal browser behavior. You need to take additional steps to prevent that on secured pages.

For the multiple session issue, check to make sure that you don't have an underline in any of your cookie names.


php sessions generate many files for the application - El Forum - 05-03-2012

[eluser]joe_h[/eluser]
What steps?


php sessions generate many files for the application - El Forum - 05-03-2012

[eluser]CroNiX[/eluser]
It's a very popular topic on google as it has to do with a very common problem in HTML and it's not php or ci specific.