still losing session userdata across a redirect |
I did not put enough P's in APPPATH. (Earlier reply has been corrected.) It's defined in index.php
Thanks. That took care of it. Funny how one mispelled thing can totally eff up you code. IDE's in the past (ie PWB) wouldn't let that happen.
proof that an old dog can learn new tricks
(12-01-2017, 08:49 AM)richb201 Wrote: I changed the past for cookies to: $config['sess_save_path'] = 'c:\xampp\htdocs\sub_crud\session_cookies'; Yes, that is what I meant. cookie_domain should be set to your website's domain ... I just now notice that you're working on localhost - that can cause problems with cookies, try emulating an actual hostname. (12-01-2017, 09:44 AM)dave friend Wrote: Try a more "sane" folder to store the session files. Session files are not cache, don't recommend this. A directory prepared specifically for session files is the most sane thing.
I don't think anyone else has mentioned it, but I've learned that there can be problems with the order that you set session data and do the redirect. I always set the redirect before writing to the session. I've had problems changing that order in the past.
This is how I setup my file sessions, there may be a better way but it works for me.
Create a new directory named writable in the root along with the ./application and ./system directories. This is the config.php settings: PHP Code: // Session settings. Works just fine for me and makes it easy to delete the session files when needed. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(12-02-2017, 01:42 PM)skunkbad Wrote: I don't think anyone else has mentioned it, but I've learned that there can be problems with the order that you set session data and do the redirect. I always set the redirect before writing to the session. I've had problems changing that order in theI don't really understand. But ill try it.
proof that an old dog can learn new tricks
(12-03-2017, 05:59 AM)richb201 Wrote:(12-02-2017, 01:42 PM)skunkbad Wrote: I don't think anyone else has mentioned it, but I've learned that there can be problems with the order that you set session data and do the redirect. I always set the redirect before writing to the session. I've had problems changing that order in theI don't really understand. But ill try it. I don't really understand the reason either, but it has made a difference for me when doing redirects and dealing with sessions.
Skunk, I tried it out and it worked! Then I removed it back to the old order, and it seems it still worked. So I am not sure what made that happen. I did recently follow Dave instructs on moving the base_url which might be the reason it now works. I am using phstorm and debugging with xdebug. The debugging has stop working. It seems to be stopping at breakpoints but when I try using phpstorm to find the spot, there is no breakpoint there. Very frustrating because as I like to say, I couldn't code 10 lines w/o a debugger. Any who I am am just glad to be unstuck.
proof that an old dog can learn new tricks
(12-03-2017, 04:27 AM)InsiteFX Wrote: It's supposed to be secure, not just writable. This is the entire reason why it is up to you to set it up properly, otherwise the framework can easily find the OS tmp path and use it - that's not the point. (12-03-2017, 11:27 AM)skunkbad Wrote:(12-03-2017, 05:59 AM)richb201 Wrote:(12-02-2017, 01:42 PM)skunkbad Wrote: I don't think anyone else has mentioned it, but I've learned that there can be problems with the order that you set session data and do the redirect. I always set the redirect before writing to the session. I've had problems changing that order in theI don't really understand. But ill try it. Can you elaborate and/or show examples of this where it does/doesn't work? It's not something that should make a difference. If anything, doing a redirect before altering session vars could discard those changes to the session. |
Welcome Guest, Not a member yet? Register Sign In |