Welcome Guest, Not a member yet? Register   Sign In
Codeigniter deletes the session I wrote after refreshing the page
#1

(This post was last modified: 07-07-2021, 06:05 AM by huseyinalperenn.)

I am using Codeigniter. I have not encountered such an error in a long time. In my login function inside my login controller, I want to print an array returning from the Login Model to the session. I also use Elephant.io. 

Code:
$this->session->set_userdata($validate); $client->emit('form_data', ['success' => $this->session->all_userdata()]);

when I write the array named $validate to the session, it sends all the data of the session to nodejs with emit at the bottom and there I'm printing to the console.

So when I send $this->session->all_userdata() with emit I can see the data in the $validate array. For your information, the issue has nothing to do with NodeJS. However, when I refresh the page, all the data I have written in the session is deleted. As a solution, I tried 

Code:
$this->session->set_userdata('uid', $validate)

Code:
$_SESSION['uid'] = $validate

 and it didn't work. I've read articles on various sites about this topic on the internet or looked at the same problems and solutions on stackoverflow and similar platforms, but there was no solution to my problem. In the same controller in the construct function.

Code:
$this->session->set_userdata('uid', 'test'); print_r($this->session->all_userdata()); die();

When I print this the 'test' data is not deleted even if I refresh the page hundreds of times. So it works inside the construct. I am calling session library in Construct.

I haven't been able to solve this problem for 2 days now, I've reached the stage of going crazy. I have explained my problem at length here, I hope a solution is found. I am using the latest version of Codeigniter. My PHP version is 7.3.11 I am using Ampps as apache server. Thanks to everyone who has helped so far <3
Reply


Messages In This Thread
Codeigniter deletes the session I wrote after refreshing the page - by huseyinalperenn - 07-06-2021, 12:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB