Saving session on database get session id |
HI , how can i get the id of ci_sessions table of the user logged (to save in users table ) ? this is my session data:
Code: __ci_last_regenerate|i:1690527426;admin_id|s:1:"2";admin_email|s:25:"[email protected]";is_admin|i:1;is_super_admin|s:1:"1";_ci_previous_url|s:76:"http://riepilogo_locale/index.php/admin_Dipendenti/lista_completa_dipendenti";
What do you want to do?
session()->get('your_session_key'); return current session data
or use query builder as: PHP Code: $db->table('ci_session')->where('id', $session_id)->get()
sessions are not designed for this. In what situation do I need to make requests?
I must add a field in users tablet ( id_ci_sessions) and save the id of ci_sessions tablet when user login . If the session are bot expired( time x for esample 60 Min) another user cannot login...
This is not how they do it. Add the `token` or `logged_in` field to the user table. In the session, store this label (code, hash) Create a filter with a label check in the session and delete it if the session is lost. Now, if a new user logs in, the token will change and other sessions will become invalid. This is the general logic, you have to adapt for yourself
You could create a logged_in database table and store the users_id in it, then with each log in check it
for the user_id to see if thery are already logged_in. Something like this. Code: -- -------------------------------------------------------- You would need to check this table each time when a user logs into the system before logging them in. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |