so every time a page loads, you know that it uses browsing, metadata, such as time intervals from page change (Bot detection), local information, user template selection. all that is required for this session.
As you said $con , let me explain something.
There are several type variables in php, and the main ones are:
- strings
- boolean's
- Integer in
- objects
- arrays
- Resources
Now you can store all of them in sessions, except for resources, since there are such things as file descriptors, connections to external objects that open only while the page is being processed by PHP, and then closes.
others are fine, since they are stored in memory and static as such, they will not change unless you programmatically change them.
The main tasks you should keep in your session are
- GUID So that you can track what the user has registered.
- Flash data . Therefore, if you redirect, you can display an error message on another page.
- Browser data so that you can compare that the browser you are currently viewing is the same as the last one, so you can kill a security session.
Things like database data, such as user strings, should not be stored in the session, and you should create a separate caching mechanism for this.
source share