garrisonian14 Posted April 20, 2009 Share Posted April 20, 2009 Hi All, I am trying to put a check in my php code to verify that cookies are enabled on client browser or not . I need help in this regard, Can anybody please give some clue, how can i do this ? Is this possible in php or i will have to do this in Javascript. Looking for your help Regards, Ali Quote Link to comment https://forums.phpfreaks.com/topic/154895-check-cookies-are-enabled-on-client-browser-or-not/ Share on other sites More sharing options...
soak Posted April 20, 2009 Share Posted April 20, 2009 You can do it in php with setcookie() but you won't know until the next page load if they've worked or not. Soooo, maybe something like this: if (!isset($_GET['cookiecheck']) { setcookie(blah, blah, blah); header('Location: ?cookiecheck=true); die(); } if (isset($_COOKIE['blah']) && $_COOKIE['blah'] == THE_VALUE_YOU_SET_IT_TO) { echo 'Cookies are enabled'; } Quote Link to comment https://forums.phpfreaks.com/topic/154895-check-cookies-are-enabled-on-client-browser-or-not/#findComment-814712 Share on other sites More sharing options...
taquitosensei Posted April 20, 2009 Share Posted April 20, 2009 you'll have to use javascript. Set a cookie then check for it. Do a google search for javascript cookies, you'll find lots of functions to do both. Quote Link to comment https://forums.phpfreaks.com/topic/154895-check-cookies-are-enabled-on-client-browser-or-not/#findComment-814714 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.