Hey, I have an app with a login/logout function and I want to be sure that if someone is already logged in then the same user logs in again, the first session is logged out. (the idea is: only one session at a time with each username.)
To do this I think I need to watch the session ID and keep it in the db with the usrename, so if a user logs in and they already have a SID assocated with their name, kill that SID (the original session) and start recording the new SID. right?
3 questions:
is this the best way to do it?
the PHP-generated session ID is reliable and unchanging from page to page, right? (I require cookies and use sessions now in the app to keep them logged in from page to page.)
is there some way I can do this without using the db? I guess not since one session can't talk to another session without going through an intermediary (like a database), right? (does that make sense?)
just trying to wrap my head around this, appreciate any thoughts.
best
Eric