How to get the session number (which is supposed to be unique and unchanged)?

0

I have read that if a user opens a session a unique ip is created for their session, then I thought I could use the unique session identifier to simulate an ip. I want to know how to return the unique session number that is assigned to the person who is logged in ... But I also want to be sure that this code will never change.

    
asked by user104554 16.12.2018 в 23:02
source

1 answer

1

When a PHP session starts, a unique ID is generated.

To get the ID of the current session, in PHP, (unique ID) the function is used: session_id () .

If there is no session, it will return an empty string ("").

session_id () allows you to change the ID value of the current session. Characters are allowed in the range a-z A-Z 0-9 commas and signs - (less).

The ID does not change after the login, but can be changed programmatically with session_id () or session_regenerate_id () , for example.

More info on session_id ()

    
answered by 16.12.2018 в 23:31