SaranacLake Posted February 1, 2021 Share Posted February 1, 2021 Is there a way for my PHP to check if a user has disabled cookies in their browser, thus breaking my $_SESSION? Since I don't know Javascript, that isn't an option. Quote Link to comment https://forums.phpfreaks.com/topic/312082-check-if-cookies-enabled/ Share on other sites More sharing options...
requinix Posted February 1, 2021 Share Posted February 1, 2021 35 minutes ago, SaranacLake said: Is there a way for my PHP to check if a user has disabled cookies in their browser, thus breaking my $_SESSION? People who disable cookies have a fundamentally broken internet experience. They're used to creating exceptions in their browser to allow sites to work. Remind people your site uses cookies - which you kinda "have" to do already, thanks to GDPR. 35 minutes ago, SaranacLake said: Since I don't know Javascript, that isn't an option. Well that's the dumbest excuse I've heard all month. Quote Link to comment https://forums.phpfreaks.com/topic/312082-check-if-cookies-enabled/#findComment-1584184 Share on other sites More sharing options...
SaranacLake Posted February 1, 2021 Author Share Posted February 1, 2021 1 minute ago, requinix said: People who disable cookies have a fundamentally broken internet experience. They're used to creating exceptions in their browser to allow sites to work. Remind people your site uses cookies - which you kinda "have" to do already, thanks to GDPR. I did add a message to my "Contact Us" form, but since my error logging relies on the SESSION, all I get is a catch-all message. Would be nice to have a way to log that the issue is the user's cookies are off. Not a real worry for v1.0 1 minute ago, requinix said: Well that's the dumbest excuse I've heard all month. No, it isn't. I don't plan on learning Javascript before I go live. And I certainly wouldn't take time to learn it so i can know f the user disabled cookies on my site. My site will through a general error in any places that rely on SESSIONS, so that is good enough. As far as GDPR, yeah i sorta need to add that into my site before I go live - I guess... Quote Link to comment https://forums.phpfreaks.com/topic/312082-check-if-cookies-enabled/#findComment-1584185 Share on other sites More sharing options...
cyberRobot Posted February 1, 2021 Share Posted February 1, 2021 You could potentially try setting a session variable (or cookie in PHP) and reload the page. If the session variable (or cookie) doesn't exists after the page reloads, you could display an error message to the user. Quote Link to comment https://forums.phpfreaks.com/topic/312082-check-if-cookies-enabled/#findComment-1584186 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.