Codeigniter session getting destroyed after redirect

Viewed 53

May be a duplicate, but the answers on such questions does not work.

  1. CodeIgniter version: 3.1.13, the latest.
  2. Server Software: Ubuntu 20, Apache, PHP 8.0, PHP 8.1

What's happening?

Session (logged in user information and other) getting destroyed after being redirected from an external website (probably Payment Gateway page) to the website with POST data.

Is session getting destroyed after being redirected to the website without POST data?

No.

Are cookies getting destroyed?

No.


Session Data before getting redirected: www.example.com

enter image description here

Session Data after getting redirected from subdomain with POST data another.example.com.

enter image description here

Session Data after getting redirected from a different domain without any POST data example-two.com

enter image description here

Session Data after getting redirected from a different domain with POST data example-two.com

enter image description here

1 Answers

go to system/libraries/Session/session.php and find below code:

ini_set('session.name', $params['cookie_name']);

and replace it with this code:

ini_set('session.id', $params['cookie_name']);
Related