Page 1 of 1
Session Vars
Posted: Wed Jul 12, 2006 5:01 pm
by Todd_Z
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?
Posted: Wed Jul 12, 2006 5:29 pm
by bdlang
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
Code: Select all
$sid= md5(uniqid(mt_rand(), TRUE));
session_id($sid);
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.
Posted: Wed Jul 12, 2006 5:35 pm
by Todd_Z
Thanks bdlang,
Now that I'm going over it in my head, its a much better idea for so many reasons to keep track of sessions in tables.