Jump to content

No Cookie Redirect


kool_samule

Recommended Posts

Hi Chaps,

 

Quick question on this one, I've got a <noscript> tag in my HTML to check to see if Javascipt in enabled, but how do you check to see if cookies are enabled?

Is there HTML code / PHP function, or do you simply try to set a cookie and redirect on failure to read the cookie you just to to set?

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/204778-no-cookie-redirect/
Share on other sites

Hi there Kool_samule,

 

To check for this option, you would try to set a cookie, but place it in a if clause, as the function itself returns a bool therefore you can see if the function was set in the first place ;)

 

if(setcookie("cookieName", "cookieValue", time()*60*60*24), "/")){

//cookie was set

}else{

//cookie was not set

}

 

Hope this helps you ;)

 

Cheers,

Rw

Link to comment
https://forums.phpfreaks.com/topic/204778-no-cookie-redirect/#findComment-1072097
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.