On a production server codeigniter 3.1.2 (PHP) Session Automatically destroy redirection from the facebook API?

when redirecting a codeigniter session, it destroys some time of its work and some time when it destroys the session and sends the user to the login page

Here is the Config.php session code

$config['see_driver'] = 'database'; $config['see_cookie_name'] = 'ci_session'; $config['see_expiration'] = 0; $config['see_save_path'] = 'ci_sessions'; $config['see_match_ip'] = FALSE; $config['see_time_to_update'] = 10000; $config['see_regenerate_destroy'] = FALSE; 

and that’s how I set up a user session after logging in and authenticating from the database in User_controller.php

 private function __set_user_session($user) { if(isset($user)) { $data = [ 'user_id' => $user['id'], 'ilocal_user_id' => $user['ilocal_user_id'], 'package_id' => $user['package_id'], 'no_available_business' => $user['no_available_business'], 'name' => $user['name'] ]; $this->session->set_userdata($data); } } 

After the contact book is connected and redirected, this method is called and automatically redirected to the user on the login page, I do not know why it destroys the session

 public function connect_facebook_account($business_id) { $this->__load_business($business_id); try { if(isset($this->data['business'] )) { $this->fb = new Facebook(); $this->data['facebook_url'] = $this->fb->get_login_url($business_id); if(isset($_GET['code'])) { $social_acccount_info = $this->fb->fetch_access_token(); if($social_acccount_info['status'] === TRUE) { $social_acccount_info['business_id'] = $business_id; // save data of connected account $this->__create_social_account($social_acccount_info); redirect($this->session->social_page_redirect); } } if (is_page_connected($business_id) === NULL) { $this->data['pages'] = $this->fb->fetch_facebook_pages($business_id); } } } catch(Exception $e) { $this->session->set_userdata('message', $e->getMessage() ); } } 

this code works fine on localhost, and sometimes it also works on a production server, but most of the time it destroys a production session, but it works on a local machine?

any solution?

+7
redirect php facebook codeigniter session
source share
1 answer

This is a common problem that I spent a lot of time tracking a few months ago. This article contains a good workaround, but not full resolution ... works like a charm, as a rule.

http://blog.thecodingbox.me/codeigniter-frequent-session-expiration-fix/

0
source share

All Articles