Update a cookie value without changing its expiry date?
$c = $_COOKIE["count"];
$c++;
if (isset($_COOKIE["count"])) {
setcookie("count", $c);
}
else
{
setcookie("count", $c, time() + 86400, '/');
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The only way you can update a cookie’s value without updating its expiry date is by adding the expiry date itself into the value; that’s because a browser only sends you the names and values of the cookies.