• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeigniter Session Files

#1
Hi,

For some reason the codeigniter 3.0.6 session files creates another file each time session is autoload in autoload.php

PHP Code:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 10// ten min should be
$config['sess_save_path'] = FCPATH 'application/cache/';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = TRUE// I have tried false 


And On my code if session expire should display message once I am not using flash data

And it all ways shows status ok message


PHP Code:
public function edit() {
        
$session_userdata $this->session->userdata('token');
        
$input_get_data $this->input->get('token');

        if ((isset(
$session_userdata) && !isset($input_get_data)) || ((isset($input_get_data) && (isset($session_userdata) && ($input_get_data != $session_userdata))))) { 
         
      echo "not ok!";
        } else {
            echo 
"status is ok";
        }
    } 
Controller

PHP Code:
class Register extends CI_Controller {

    public function 
__construct() {
        
parent::__construct();
        
$this->load->library('form_validation');
        
$this->load->library('upload');
    }

    public function 
edit() {
        
$session_userdata $this->session->userdata('token');
        
$input_get_data $this->input->get('token');

        if ((isset(
$session_userdata) && !isset($input_get_data)) || ((isset($input_get_data) && (isset($session_userdata) && ($input_get_data != $session_userdata))))) { 
         
      echo "not ok!";
        } else {
            echo 
"status is ok";
        }
    }

    public function 
index() {

        
$this->load->library('encryption');

        
$key bin2hex($this->encryption->create_key(16));

        
$data = array(
            
'token' => $key
        
);

        
$this->session->set_userdata($data);
        
        echo 
anchor('route=account/register&m=edit&token=' $key'Testing');
 
               // http://localhost/codeigniter/index.php?route=account/register&m=edit&token=cc8c5f54817fc12d582926b80a36290d
    
}



Question is there any reason why it creates multiple session files? and also why my message is saying status is ok all time?
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply

#2
Quote:
PHP Code:
$config['sess_expiration'] = 10// ten min should be 

in /application/config/config.php:

PHP Code:
/*
...
| 'sess_expiration'
|
|    The number of SECONDS you want the session to last.
|    Setting to 0 (zero) means expire when the browser is closed.
|
...
*/ 

10 seconds != 10 minutes, just a thought anyway.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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