I come from a security background where I was an infosec consultant and tested webapps for vulnerabilities. I've just started working as a webdev and I'm busy with my first project, written with Codeigniter.
I'm trying to solve the problem of multiple concurrent logins, where the user can have two (or more) concurrent sessions that are both valid and active. I have an idea how to do this but I'm not experienced with CI so I want to know if there's a better or more "official" way. It also involves making changes to the DB's ci_sessions table, not sure how CI will handle it.
At the moment I'm using the DB to session data, my plan is to add an additional coloum to the ci_sessions table, one that stores the email address of the user (post authentication). In other words it will be NULL until the user successfully logs in, at which point the email address of the user will be stored in it.
The plan is to confirm the validity of the credentials provided during login and if they're correct search the sessions table for other sessions corresponding to the same email address and delete those. Once other sessions for the user have be removed then the email and session data indicating a valid authenticated session will be set.
Is this the best way to do this?
EDIT: Of course, this won't work when CI creates a new session id for a current session, instead of updating, as CI won't set the email address to the new session. I'd have to make modifications to the source...