Session_id & session_regenerate_id in PHP

We can create a unique number for the session of the browser by generating a session id. Session id is generated by PHP at server end user can't change the generated session id. However it can be re-created.

Here is the code.
echo session_id();

How session_id changes when we login

Each time we login by our userid and password we get a new session_id. A particular session_id may be associated with a userid but it keep on changing each time the same member login. If there are ten members logged in to your website at a moment then there will be ten different session id and each member will be associated with one session id.

Re generating the session_id

By using script we can regenerate another session_id. Here is the function .
session_regenerate_id();
Note that this is not same as session destroy or logout, here we are only changing the session_id value to a new one. All other session data remains unchanged.
PHP Session variable creating checking and destroying using session_start() using userid and name

Session Variable Session Array

Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Post your comments , suggestion , error , requirements etc here





    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer