CodeIgniter Forums

Full Version: php sessions generate many files for the application
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

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:

class Login extends CI_Controller {
    var $SID;

    function __construct()
        $this->SID = SID;

    public function index(){

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

    public function loadViews($user){

        $data["usuario"] = $user;
        $data["SID"] = $this->SID;

    public function logout()
        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?

El Forum

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.

El Forum

What steps?

El Forum

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.