PHP tracks who is who using sessions, which in turn use cookies to identify server data.
Session cookie is similar to
PHPSESSID=0f0f0f0f0f0f0f0f0f... (32 hexits, usually)
Session data is stored on the server side, so the user will not be able (easily *) to change their clientid to someone else. I speak easily, because the user can try to adjust the PHPSESSID value and access another server session (but this should take a long time).
You can also use other tactics, such as XSS exploits , to discover other server sessions.
You can search StackOverflow for more information:
To be safe, make sure that you do not output user input without prior sanitation (using HTMLPurifier or htmlspecialchars() ) and call session_regenerate_id() whenever you log in / log out or escalate user privileges.
source share