Copy link to clipboard
Copied
After the initial load - which will require a query regardless - is it faster on subsequent page loads to pull cookie data, or just re-run the same query at the top of each page - or is it about the same?
Thanks in advance
Copy link to clipboard
Copied
For log-ins, I always set session variables.
Cookies are client-side. Not so good if JS or Cookies are disabled.
Nancy O.
Copy link to clipboard
Copied
Pulling a cookie from the users computer to the server would be significantly slower than a mysql query, assuming the query is very simple and the table isn't huge.
But you could store cookies and session data on the server. Maybe your question requires more explanation.
Copy link to clipboard
Copied
For log-ins, I always set session variables.
Cookies are client-side. Not so good if JS or Cookies are disabled.
By default, php session variables use a cookie to store the session ID. So even if you're using session variables and you haven't explicitly told your server NOT to use session cookies (which will instead use a GET parameter to retrieve session data = not as secure as using default cookie for session id) then it's still not so good if cookies are disabled.
More info at Do PHP sessions set any cookies? - Stack Overflow
best,
Shocker