Welcome Guest, Not a member yet? Register   Sign In
Altering Database Session behavior
#1

[eluser]domainsvault[/eluser]
Can anyone help me figure out a way to alter the session behavior without effecting the core of CI?

What I want to ultimately achieve is adding one more column to the DB that handles the sessions, so I can add a unique ID for my registered users when they are logged in, so I can build up a "who's online now" type feature. My issue at hand is not really being extremely familiar with the way CI handles the session data between session and DB I am not sure where to begin on this idea, let alone not to sure if I am thinking correctly with this logic? Maybe it may be easier to just roll out a new table for the purpose of this, however I figure maybe reduce the over head of an extra table by doing something with the existing sessions.

Main reason I need to add the unique id to the existing session data is cause the people online feature I am doing has to tie into the associations between my users, as I let them choose which of the people they will allow to see them online when they are online. I know I can store this independently within the session data itself, but thats nothing I can really use from the database perspective when its not a global concept for everyone across the board. I need to tie each session to a user. So I can then come up with a means of cross referencing it with the list of allowed people per user.

I guess the best way to sum it up without going around in circles trying to describe it is, think of facebook, when your online and you go to your page, you see whos online, I want to mimic that in a sense of speaking. So is this something anyone things can be done with the sessions and session db or should I approach this from another angle and build up an independent table for the cause.
#2

[eluser]Aken[/eluser]
You can add user information, like their specific ID, to the session data when they login. Then, you could figure out how to query for currently active sessions (perhaps ones with non-empty user data), and then loop through the results, unserialize the user data and get their ID from that, and go from there. Shouldn't be too hard.

And you should save user preferences to the database, not to the session.




Theme © iAndrew 2016 - Forum software by © MyBB