Welcome Guest, Not a member yet? Register   Sign In
Lost session
#34

(This post was last modified: 07-07-2021, 09:47 AM by Gary.)

(05-21-2020, 02:57 AM)jim1001 Wrote:
(11-04-2019, 09:35 AM)Gary Wrote: if I remember correctly, I believe I previously experienced the same problem of losing session data when using the redirect() command in my code... but manage to side-step the issue at the time by using other ways to call the new page (without using the redirect() command directly).

I too am using out-ofbox settings and session data could be picked up in other php files of my app until I started to use a redirect() when I found all
 session data was lost in the redirected page.

I read about alternative redirect way to side-step issue and tried the header('Location...) solution but that also didn't work. I'm using PHP 7.4.5 and CI4.

Any advice welcome - thanks.

Sorry... being a bit of a noob and, at best, a complete hack on the computer, my visits to this site are sporadic... often with long interludes.  Not being an expert, I also don't bother subscribing to threads, because most of the time I don't have a lot to add.

At any rate, for those that end up on this page, searching for solutions in the future... quite a few things can cause the the session to get lost. Under the situation discussed in this thread, you could possibly try using < session_write_close(); > before you invoke header() or redirect().

The new versions of PHP close the session for writing more often than the earlier versions did... for example if < exit; > is used in the code... but I think there are still cases (like the two mentioned above) that it currently (may) not - which causes it to remain open and therefore blocked (essentially lost) for the new page one is redirecting to.
Reply


Messages In This Thread
Lost session - by scalla - 04-19-2018, 05:03 PM
RE: Lost session - by natanfelles - 04-19-2018, 05:29 PM
RE: Lost session - by skunkbad - 04-19-2018, 05:30 PM
RE: Lost session - by scalla - 04-19-2018, 05:44 PM
RE: Lost session - by scalla - 04-19-2018, 05:50 PM
RE: Lost session - by InsiteFX - 04-20-2018, 11:13 AM
RE: Lost session - by scalla - 04-21-2018, 12:45 AM
RE: Lost session - by InsiteFX - 04-21-2018, 03:59 AM
RE: Lost session - by scalla - 04-21-2018, 07:32 AM
RE: Lost session - by dave friend - 04-21-2018, 08:50 AM
RE: Lost session - by scalla - 04-21-2018, 09:11 AM
RE: Lost session - by InsiteFX - 04-21-2018, 09:34 AM
RE: Lost session - by scalla - 04-21-2018, 10:40 AM
RE: Lost session - by InsiteFX - 04-22-2018, 05:06 AM
RE: Lost session - by scalla - 04-22-2018, 01:52 PM
RE: Lost session - by InsiteFX - 04-22-2018, 02:56 PM
RE: Lost session - by scalla - 04-23-2018, 04:34 AM
RE: Lost session - by scalla - 04-23-2018, 11:06 PM
RE: Lost session - by kilishan - 04-22-2018, 07:50 PM
RE: Lost session - by scalla - 04-23-2018, 04:35 AM
RE: Lost session - by InsiteFX - 04-24-2018, 03:55 AM
RE: Lost session - by scalla - 04-24-2018, 04:00 AM
RE: Lost session - by InsiteFX - 04-24-2018, 06:56 AM
RE: Lost session - by scalla - 04-24-2018, 09:51 AM
RE: Lost session - by Narf - 04-24-2018, 11:46 AM
RE: Lost session - by Mayk - 04-24-2018, 12:24 PM
RE: Lost session - by scalla - 04-25-2018, 07:52 AM
RE: Lost session - by Mayk - 04-25-2018, 11:04 AM
RE: Lost session - by natanfelles - 04-24-2018, 11:40 PM
RE: Lost session - by InsiteFX - 04-26-2018, 03:17 AM
RE: Lost session - by Gary - 11-04-2019, 09:35 AM
RE: Lost session - by jim1001 - 05-21-2020, 02:57 AM
RE: Lost session - by Gary - 07-06-2021, 12:09 PM
RE: Lost session - by hmiura - 05-07-2021, 01:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB