Page 1 of 1

Simple Coding Problem with $HTTP_COOKIE_VARS

Posted: Fri May 14, 2010 1:32 am
by creeper101
I have written the following code:

Code: Select all

<?php
if(empty($HTTP_COOKIE_VARS["times"]))
{
	$times=1;
}
else
{
	$times=$HTTP_COOKIE_VARS["times"];
	$times=$times+1;
}
setcookie("times", $times, time()+3600);
echo "This is your $times visit within an hour";
?>
this code should preview like this:

Code: Select all

This is your 1 visit within an hour

and when i will reload the page the '1' will change to '2' and then to '3' and so on.
However when i reload the page it still remains '1' and doesnt show '2'.
is anything wrong in this script?

Re: Simple Coding Problem with $HTTP_COOKIE_VARS

Posted: Wed May 19, 2010 5:31 am
by Benjamin
Yes, $HTTP_COOKIE_VARS is no longer used.

http://php.net/manual/fr/reserved.variables.cookies.php