Simultaneous exchange of a code signal for several requests

I have an ecommerce website running in codeigniter. Sessions normally work fine. The problem starts when, say, for example, if there are two users on my site and they are supposed to be logged in, and when they click any action, for example, add to cart or proceed to checkout or place an order at the same time. when login sessions are swapped.

Can anyone help me with this! I searched a lot but couldn't find a good solution.

I am using config file like this

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

      

I won, I will not be able to use the sess_driver database as it will affect the performance of my website I suppose.

Thanks in advance!

+3


source to share


1 answer


As you say, users are logged in, which means there is a login button through which users are logged into your system. So, controller that mentions your login function, you can create a constructor and load your session library like below:

public function __construct()
{ 
  $this->load->library('session'); 
}

      



And make sure your system has a Logout button where sessions can be destroyed when you click Logout. You can just try it. Just thought it might help.

0


source







All Articles