...

View Full Version : question about grabbing a session ID



misterx
04-26-2004, 10:44 PM
Does anyone have any opinions as to whether or not you should use session_id() or $_SESSION['SID'] to get the surrent session id? I only ask because recently I read here that session_register() is not a good way to set session variables and i was wondering if session_id() was also bad for some reason.

Also, I can't seem to find how long a session id is though I think it might be 32 characters. Can anyone confirm this? Thanks.

raf
04-27-2004, 03:14 PM
i always use the session_id() because
- it is always set, unlike the SID
- i don't know the $_SESSION['SID'] --> there are 0 searchresults for it in the manual
- there is no downside to using it.

I don't see the relevance with the depreciated session_register() --> should not be used because your code will then only work if register_globals=on , which is certainly for newer installations not always true.

The standard sessionID is the result of an md5-hash, which always is 32 characters long.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum