I believe that the best way to create a cache / session / folder in your system directory is more secure. I put important things, such as logs and cache in the system, and not in the application folder.
http://www.codeigniter.com/user_guide/libraries/sessions.html
config.php
$config['encryption_key'] = 'somekey'; $config['sess_driver'] = 'files'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_save_path'] = BASEPATH . 'cache/sessions/'; $config['sess_match_ip'] = TRUE; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = TRUE;
I will also autoload sessions myself
application /Config/autoload.php
$autoload['libraries'] = array('database', 'session');
Usage example
Upon successful login form_validation
$data = array( 'is_logged' => true, 'username' => $this->input->post('username') ); $this->session->set_userdata($data);
One of them you set your data after the login can receive the sessions $this->session->userdata('username') , etc.
Mr. ED source share