dave111 Posted October 22, 2005 Posted October 22, 2005 I'm trying to have some text show if cookies are/or are not enabled in the admin area. Example: If cookies are enabled in browser it says "you have cookies" or not then it says "you dont have cookies" I've tried all the following: <?php if ($use_cookies) { echo 'something something'; } ?> <?php if ($send_cookies) { echo 'something something'; } ?> <?php if ($sessions->use_cookies) { echo 'something something'; } ?> Any ideas, i know its bound to be something simple like using the wrong variables.
Guest Posted October 22, 2005 Posted October 22, 2005 Hi Dave, there is some code in application_top that checks the HTTP_COOKIE_VARS array So I just used it for the example below: if (isset($HTTP_COOKIE_VARS['cookie_test'])) { echo 'cookies on'; } else { echo 'cookies off'; }
dave111 Posted October 22, 2005 Author Posted October 22, 2005 Hmm, doesnt seem to work, it just always shows "cookies off" with this example :\
Guest Posted October 22, 2005 Posted October 22, 2005 ok, couple of things you would have to copy the part of the code from the catalog side that sets the cookie_test over the admin. Or you could simply set it over the admin side by calling the setcookie function (like the code below). Then you check with the $HTTP_COOKIE_VARS array if the specific cookie is set. If do the test in a function set the $HTTP_COOKIE_VARS array as global for manipulation. setcookie('cookie_test', 'please_accept_cookie', time()+3600); /* expire in 1 hour */
dave111 Posted October 22, 2005 Author Posted October 22, 2005 I got it to work with this: <?php if ($_COOKIE) { echo 'cookies on'; } else { echo 'cookies off'; } ?>
n_e_w_s Posted November 8, 2005 Posted November 8, 2005 Hi guys, EU laws require me to tell customers how/why cookies are used on my OSCsite so I'm wondering is there any specific reason cookie_test is valid for 30 days ? And what is to purpose of cookie_test ? If I turn cookie_test to expire "at the end of session" does it harm/brake some features of the OSC ? "The cookie set is titled cookie_test and will exist on the clients computer for 30 days." See: chapter: Force Cookie Usage http://www.oscommerce.info/kb/osCommerce/D...plementations/4
Recommended Posts
Archived
This topic is now archived and is closed to further replies.