Forum Moderators: coopster
if(!isset($HTTP_COOKIE_VARS['cart_id'])) {
$cart_id = md5(uniqid(rand()));
setcookie("cart_id", $cart_id, time() + 14400, '/');
} else {
$cart_id = $HTTP_COOKIE_VARS['cart_id'];
}
The cookie sets correctly, however, it does not stick, it keeps getting re-created. This code worked at one time, but I had to re-install Apache and PHP. Ever since the reinstall it doesn't work. I am thinking I don't have something enabled in one of the two if not both. Can anyone help?
As a very dirty workaround you could do something like this:
<?php
$HTTP_COOKIE_VARS = $_COOKIE;
// rest of script;
But if you do some reading on register_globals you may decide that that is not a decent approach, regarding security.