# |
May 29th 2017, 21:19 |
savant |
lucaskpo123 did you try what lorenzo said to try? |
# |
May 29th 2017, 21:18 |
lucaskpo123 |
can anybody help me |
# |
May 29th 2017, 21:17 |
lucaskpo123 |
Hellw |
# |
May 29th 2017, 21:01 |
lucaskpo123 |
alguno habla español para que me brinde sus conocimiento |
# |
May 29th 2017, 21:01 |
lucaskpo123 |
Buenas señores |
# |
May 29th 2017, 20:23 |
lucaskpo123 |
I have cakephp 1.2 and when doing a redirection the session is deleted |
# |
May 29th 2017, 20:22 |
lorenzo |
@lucaskpo123 try calling session_write_close() before redirecting |
# |
May 29th 2017, 20:22 |
lucaskpo123 |
Good, I need help with a serious theme of session by database |
# |
May 29th 2017, 20:21 |
lucaskpo123 |
hello |
# |
May 29th 2017, 20:21 |
chris-andre |
I was too busy with the model :P |
# |
May 29th 2017, 20:21 |
lucaskpo123 |
I have problems with database session in cakephp 1.2 [5:19] When I do a redirect the session is deleted |
# |
May 29th 2017, 20:20 |
lorenzo |
np :slightly_smiling_face: |
# |
May 29th 2017, 20:20 |
chris-andre |
Typo. Thanks :slightly_smiling_face: |
# |
May 29th 2017, 20:19 |
chris-andre |
Ah. |
# |
May 29th 2017, 20:19 |
lorenzo |
it should be `$this->request->session()->id()` |
# |
May 29th 2017, 20:19 |
lorenzo |
the problem is here `$this->request->sessions()->id()` |
# |
May 29th 2017, 20:19 |
lorenzo |
ah ok, then it has nothing to do with using the model |
# |
May 29th 2017, 20:18 |
chris-andre |
> Method sessions does not exist |
# |
May 29th 2017, 20:17 |
lorenzo |
@chris-andre and what’s the error you’re getting? |
# |
May 29th 2017, 20:11 |
chris-andre |
Last try was with TableRegistry, as you can see. |
# |
May 29th 2017, 20:10 |
chris-andre |
@lorenzo Yes. Here is my controller action: https://gist.github.com/chris-andre/b22b1592702e5d3cc8081a3a74c7372c |
# |
May 29th 2017, 19:36 |
lorenzo |
are you sure you are executing that in the context of a controller? |
# |
May 29th 2017, 19:35 |
lorenzo |
`loadModel` is a method of all controllers |
# |
May 29th 2017, 19:19 |
chris-andre |
Can't sessions table be loaded like other tables/models? I have tried `TableRegistry::get()` as well. Worked inside a component, but not in my controller. Any ideas? |
# |
May 29th 2017, 19:18 |
chris-andre |
I'm trying to `$this->loadModel('Sessions')` in my controller, but I get > Method doesn't exists. |
# |
May 29th 2017, 17:45 |
JD-Robbs |
tell Blurb |
# |
May 29th 2017, 17:45 |
JD-Robbs |
~tell Test |
# |
May 29th 2017, 17:45 |
JD-Robbs |
test |
# |
May 29th 2017, 16:45 |
chris-andre |
If so, I have to do some custom code to add the user_id to the sessions table. Will look into it later. GF is pushing me out of my chair. Thanks @hmic |
# |
May 29th 2017, 16:41 |
chris-andre |
That is the table. |
# |
May 29th 2017, 16:40 |
chris-andre |
https://book.cakephp.org/3.0/en/development/sessions.html#database-sessions |
# |
May 29th 2017, 16:39 |
hmic |
you have the user_id in the sessiontable! |
# |
May 29th 2017, 16:39 |
hmic |
no |
# |
May 29th 2017, 16:39 |
chris-andre |
Yes, okay. Could do. Then I will have to look through every record until I have a match in Sessions.data |
# |
May 29th 2017, 16:37 |
hmic |
you don't. you do have the user_id in the session table, just delete the entry/ies that match the user that got changed |
# |
May 29th 2017, 16:37 |
chris-andre |
Right |
# |
May 29th 2017, 16:36 |
hmic |
well, usually you need the user session data to be reevaluated if you change something like their permissions. at least that is the example case... |
# |
May 29th 2017, 16:36 |
chris-andre |
Yes, but still I will need a join table to track the session |
# |
May 29th 2017, 16:35 |
hmic |
just ~3 lines of code in an afterSave event of the user table and you are done |
# |
May 29th 2017, 16:35 |
chris-andre |
Allright :slightly_smiling_face: Thanks. I doubt I can prove you wrong by now, so I guess I will go with deleting session. |
# |
May 29th 2017, 16:35 |
hmic |
- event on save of userdata. you can unconditionally delete that data from the session table, if the user is not logged in, it does not matter anyways. |