Session Vars
Moderator: General Moderators
Session Vars
I am wondering how, based on a unique numeric ID, to never allow two simultaneous sessions with the same ID. Currently there is no row in a table that keeps track of the sessions, its simply using the php sessions functions. Is this a mistake? Should I store all session information in tables?
So you're currently implementing your own session handling function or you're setting your own unique session ID? I would think that PHP's default session handling has error checking for this sort of thing, OTOH if you're setting your own session ID value, something like
Should be sufficient to eliminate identical current sessions, but you never know. If you create a database session handler, use the above uniqid() method along with UNIQUE indexed column to make sure it's always unique.
Code: Select all
$sid= md5(uniqid(mt_rand(), TRUE));
session_id($sid);