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.
Visitors Rating
Your Rating





Post Comment This is for short comments only. Use the forum for more discussions.




HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer