Welcome Guest, Not a member yet? Register   Sign In
Bug with sessions CI 4.5.1
#1
Question 
(This post was last modified: 04-23-2024, 01:36 PM by ALTITUDE_DEV.)

Hello CI Users, 

I'm encountering a rather strange bug with sessions in CODEIGNITER 4.5.1. Let me explain:
I log in to my dashboard, and the session is created without any issues.

- Scenario 1: If I close the browser tab and paste the URL of the admin panel, I'm still logged into my session.
- Scenario 2: If I close my browser and return to the panel via copy-paste, I'm still logged into my session.
- Scenario 3 If I close the browser tab and use the "search history," if I click on the panel in the search history, my session is destroyed, and I have to log in again, creating a new CI session.

Do you have any idea ? or its a bug ?
Reply
#2

Not sure how you are destroying your session, but try this.

PHP Code:
// remove takes eiter a single item or an array in $key
session()->remove($sessionData);

// destroy our session data.
session()->destroy();

// cleanup! 


Can you show your logout code?
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Hello i have fix my problem with cookie type "Strict" > "Lax"

Is it possible to switch PHP session to database mode other than through cookie passing?
Reply
#4

Not that I know of off hand.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

Have you checked the documentation?
https://www.codeigniter.com/user_guide/l...sions.html

The defaults are to update every 5 minutes and automatically destroy the inactive session after 2 hours. You can use a database backend instead of files but that would not likely change the behavior. 

You can change some of the session defaults. One other option may be to use tempdata in your session.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB