Welcome Guest, Not a member yet? Register   Sign In
Session proper config?
#1

autoload.php
Code:
$autoload['libraries'] = array(
    'database', 'email', 'session'
);

config.php
Code:
$config['encryption_key'] = 'Xasdf32zsdfj0e98ehBDS3xS9j3DAIHKwdfweHfdksj34Ifreaky0120302weakyshitPSYCHOP4324342ath';
...
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = $_SERVER['DOCUMENT_ROOT'] .'/ci/ci3-codes-mastery2/session/';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

controller
Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Test extends CI_Controller {

    function __construct ()
    {
        parent::__construct();

        //$this->load->library('session');
    }

    public function index()
    {
        $newdata = array(
                'username'  => 'johndoe',
                'email'     => '[email protected]',
                'logged_in' => TRUE
        );

        $this->session->set_userdata($newdata);
        
        $this->load->view('test');
    }
    
    
}

view
Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

        $data = $this->session->newdata;  
        $data2 = $this->session->userdata('newdata');


        echo 'Session Test...';
        print_r($data2);
?>

But when I run these codes nothing, the session data is not displayed.
What am I missing here?

Thanks in advance.
No SEO spam
Reply


Messages In This Thread
Session proper config? - by solidcodes - 03-11-2016, 05:53 AM
RE: Session proper config? - by keulu - 03-11-2016, 06:35 AM
RE: Session proper config? - by solidcodes - 03-11-2016, 12:21 PM
RE: Session proper config? - by salain - 03-11-2016, 07:19 AM
RE: Session proper config? - by InsiteFX - 03-30-2016, 01:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB