ok im a newbie on sessions lets imagine that we have a little login site,
heres a logic
what it use
session_register
session_destroy
session_unset
session_start
where does the session_id
& the session_regenerate
or session_name
goes in ?
at php site it says
session_id() is used to get or set the session id for the current session.
i still just dont get it, why do we need them anyway ? in real environment what does it do ?
Description ¶ session_regenerate_id() will replace the current session id with a new one, and keep the current session information.
A session ID is a unique number that a Web site's server assigns a specific user for the duration of that user's visit (session). The session ID can be stored as a cookie, form field, or URL (Uniform Resource Locator). Some Web servers generate session IDs by simply incrementing static numbers.
Definition and Usage. Sessions or session handling is a way to make the data available across various pages of a web application. The session_regenerate_id() function generates a new session id and updates the current one with the newly created one.
No, you don’t need to use them. In general all you need is
session_start
to start the session handling, andsession_destroy
to destroy the stored session data (this does not modify $_SESSION
), andsession_unset
to reset the $_SESSION
variable (but you can also do $_SESSION = array()
).session_id
and session_name
are to get and set the current session ID and session ID name (default is PHPSESSID
). session_regenerate_id
can be used to regenerate/change the session ID of the current session. This might be useful if, for example, you want to refresh the session ID every 10 minutes or after changing the state of authenticity of a user associated with a session.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With