Reputation: 1106
I read that a session ID is created using an algorithm that permits to have a tiny probability to get two equal IDs. But what happens if I get two equal ones? I don't really know how sessions work, but I imagine that I would be able to access to the data stored in the $_SESSION
array of the person that has the same ID.
In this case, that wouldn't be a positive thing. Is it possible to have a really unique session ID?
Thanks!
Upvotes: 1
Views: 411
Reputation: 11832
It is not very likely or probable that you will generate two equal session ID's. Though of course this will depend on the algorithm that was used to generate the ID's.
If you want to know how, for example PHP, sessions are generated, take a look here: PHP session IDs -- how are they generated? As you can read, these sessions are not entirely random and ingredients such as the user's IP address and time of issuance are used, limiting who can get the very unlikely equal session ID and when.
Furthermore you can limit an equal session ID to have effect, by limiting the session expiration time, allowed remote IP and domain for its usage.
Upvotes: 3