tags:

views:

69

answers:

3

Hi, I am just trying the session_id function in PHP and I thought that it was unique for each machine that used the website? However, my flatmate and I have the same session_id for on two separate machines. I'm just using session_id() to create the session - am I doing it correctly?

Thanks Tom

+1  A: 

Try creating your session like they do here

Joel
A: 

You are missing the () in your session_id call.

Also remember that you need to call session_id() before session_start() if you want to use it to set a specific session ID. From the Manual:

If id is specified, it will replace the current session id. session_id() needs to be called before session_start() for that purpose. Depending on the session handler, not all characters are allowed within the session id. For example, the file session handler only allows characters in the range a-z A-Z 0-9 , (comma) and - (minus)!

Pekka
A: 

Another idea is to store a value in the Session.

Dr. Zim
How is that related to the OP's problem? I don't understand.
Pekka
If the Session doesn't have values, I wouldn't expect it to keep the SessionID either. The session IDs may very well be unique if no one else is using that ID.
Dr. Zim