• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
session data lost after redirect

#1
hi , 
i using CI 3.0.4 and also flexi_auth lib ,
When I login, in login page i set user info in  session by set_userdata  ,
after set session redirect page To other controller but the session data which i set , was be destroyed 

this is my session config 

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = sys_get_temp_dir();
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;


And this is my output from print_r($this->session->all_userdata());


Array
(
[__ci_last_regenerate] => 1495024729
)



But When I Set $config['sess_cookie_name'] = '';

I can see my data in session
Reply

#2
I purpose you to use CI session methods as:
PHP Code:
// To get specific userdata
$this->session->userdata('item');
// If you want to specify the item
$this->session->item

Can you show what exactly you set and how you redirect..
Best VPS Hosting : Digital Ocean
Reply

#3
(01-28-2016, 05:38 AM)sv3tli0 Wrote: I purpose you to use CI session methods as:
PHP Code:
// To get specific userdata
$this->session->userdata('item');
// If you want to specify the item
$this->session->item

Can you show what exactly you set and how you redirect..

Yes this is my code in  login_model 

            $data =  $this->public_model->DB_Action('get','user_profile',
                array('upro_uacc_fk' => $current_user_id))->row_array();
            $this->session->set_userdata('user_pro',$data);

            redirect('admin');

and i check   in admin Controller

print_r($this->session->all_userdata());
Reply

#4
Could it be that you are redirecting from http://www to http:// or vice versa?
If so, that would probably the reason why you lost your sessions
Reply

#5
If your using 3.0 version codeigniter with PHP 7.0 then you have to replace your system folder with new version codeingiter's system folder
Reply

#6
(06-01-2017, 06:52 AM)mahivitsit Wrote: If your using 3.0 version codeigniter with PHP 7.0 then you have to replace your system folder with new version codeingiter's system folder

Yes ,  Im using PHP 7  , I changed but its also not work ,
Reply

#7
(06-18-2017, 12:08 AM)sdfarshid Wrote:
(06-01-2017, 06:52 AM)mahivitsit Wrote: If your using 3.0 version codeigniter with PHP 7.0 then you have to replace your system folder with new version codeingiter's system folder

Yes ,  Im using PHP 7  , I changed but its also not work ,

$config['sess_save_path'] = sys_get_temp_dir(); <-- can you write in the temp path?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
2 Guest(s)


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