I want to check which users accept cookies so I can get a rough % of users that accept cookies on one of our PHP sites.
My idea is to create a temporary acceptsCookies column in the Users table to help keep track of this (e.g. if a user accepts cookies, then their acceptsCookies will be set to “Y”, otherwise it will be set to “N”).
How can I do this on a single page (setting a test cookie, checking if it was accepted/set, updating the DB) ?
Update: To be clear, this has to be done 100% in PHP.
You can’t do it in a single step, as the cookie has to be SENT to the browser first, and will only sent back to you in a subsequent request. So if you had something like:
you could have the checkcookie.php script update your session’s acceptsCookie value.