-
20th November 2016, 12:38
#1
Assadministrator
What you try is not possible with PHP, the interpreter is basically resetted for every page request. That's why you need to reinitialize the needed data at every page request via new database queries.
When you need "sticky" variables, you could try node.js http server. The interpreter isn't "detached" behind by e.g. a FastCGI wall from the web server.
For PHP, just make a table relation between the $_COOKIE["PHPSESSID"] and the stuff you want to cache (e.g. which groups the user belongs to). Normally tho you just save the most important stuff like the session expiration time of the session and the user id, so the home.php has a way to know that the user is logged in via checking the cookie session ID against the session table.
You are welcome ^^
-
The Following User Says Thank You to kung foo man For This Useful Post:
Whiskas (20th November 2016)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules