Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 3 cannor remember session
#3

(This post was last modified: 05-12-2018, 01:07 AM by kangziru. Edit Reason: Removed link )

I set the session path to APPPATH.'sessions', which refers to sessions folder I created inside Application folder. There are bunch of files created by ci_session, which means session path should be working properly.

Here is the flow:
1. I clicked Login button.
2. Ajax sent by login page to Account/login.
3. In account/login, validate the ID and password
4. If both match, then set session data. In this case, I'm using $this->session->set_userdata($data);. Note that $data parameter I passed is a common one-dimensional array.
5. Return json to login page
6. Login page receives and processes it.
7. If the login succeeded, then redirect using javascript location object. Else display notif that the login failed.

The code should be working, because it works perfectly in local server (both pc and mobile browser) and production server (in mobile browser).

I expect that after I clicked Login button, the page should be redirected to homepage, and the sessions are still exist in my app.

But what I get in production server: after I clicked Login button, the page redirected to login page again. Which means the sessions immediately destroyed after the page redirected to somewhere. I proved it by printing $_SESSION.

If you are telling me that my computer has a problem, then you are wrong. I tested it with some computers, different networks.
Reply


Messages In This Thread
RE: Codeigniter 3 cannor remember session - by kangziru - 05-04-2018, 05:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB