Welcome Guest, Not a member yet? Register   Sign In
[Solved] Session issue : Can't keep it persistent
#1

(This post was last modified: 12-22-2016, 01:19 AM by Jurden.)

Hello,

I don't know why but I lose my session at any refresh.
I try to store it by file and now in my database.

Here it's the only thing I have when i refresh my page (anytime different) :
PHP Code:
Array
(
 
   [__ci_last_regenerate] => 1481814234


This is my current config :

AUTOLOAD
PHP Code:
$autoload['libraries'] = array( 'database''session' ); 

CONFIG
PHP Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_sessions';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 30000;
$config['sess_regenerate_destroy'] = TRUE;

$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';


$config['global_xss_filtering'] = TRUE

MODEL
PHP Code:
public function createSession(){
 
       if( !isset( $this->session->watch_dog ) ){
 
           $this->session->set_userdata'watch_dog'0);
 
       }
 
       ifget_cookie('watch_dog') == null ){
 
           set_cookie('watch_dog'0,'130000');
 
       }
 
   }

 
   public function addConnectionCounterAttempt(){
 
       $this->createSession();
 
       // SESSION
 
       $new_value $this->session->userdata['watch_dog'] + 1;
 
       $this->session->set_userdata'watch_dog'$new_value );
 
       // COOKIE
 
       set_cookie'watch_dog'$new_value'3600' );
 
   

If you have any ideas...
Thank you.
Reply


Messages In This Thread
[Solved] Session issue : Can't keep it persistent - by Jurden - 12-15-2016, 08:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB